/** * Adds a string value to the tail (right) of the list. Creates the list if the key didn't exist. * If the key exists and is not a list, FALSE is returned. * * @param string $key * @param string $value * * @return int The new length of the list in case of success, FALSE in case of Failure. * @link http://redis.io/commands/rpush * @example * <pre> * $redis->rPush('l', 'v1'); // int(1) * $redis->rPush('l', 'v2'); // int(2) * var_dump( $redis->lRange('l', 0, -1) ); * //// Output: * // array(2) { * // [0]=> string(2) "v1" * // [1]=> string(2) "v2" * // } * </pre> */ public function rPush($key, $value) { try { return $this->client->rPush($key, $value); } catch (Exception $e) { return $this->handleException($e, __FUNCTION__, func_get_args()); } }
/** * Adds a string value to the tail (right) of the list. Creates the list if the key didn't exist. * If the key exists and is not a list, FALSE is returned. * * @param string $key * @param string $value * * @return int The new length of the list in case of success, FALSE in case of Failure. * @link http://redis.io/commands/rpush * @example * <pre> * $redis->rPush('l', 'v1'); // int(1) * $redis->rPush('l', 'v2'); // int(2) * var_dump( $redis->lRange('l', 0, -1) ); * //// Output: * // array(2) { * // [0]=> string(2) "v1" * // [1]=> string(2) "v2" * // } * </pre> */ public function rPush($key, $value) { $this->appendToLog('RPUSH ' . $key . ' ' . $value); return $this->client->rPush($key, $value); }