/** * Trims an existing list so that it will contain only a specified range of elements. * * @param string $key * @param int $start * @param int $stop * * @return bool FALSE if the key identify a non-list value. * @link http://redis.io/commands/ltrim * @example * <pre> * $redis->rPush('key1', 'A'); * $redis->rPush('key1', 'B'); * $redis->rPush('key1', 'C'); * $redis->lRange('key1', 0, -1); // array('A', 'B', 'C') * $redis->lTrim('key1', 0, 1); * $redis->lRange('key1', 0, -1); // array('A', 'B') * </pre> */ public function lTrim($key, $start, $stop) { try { return $this->client->lTrim($key, $start, $stop); } catch (Exception $e) { return $this->handleException($e, __FUNCTION__, func_get_args()); } }
/** * Trims an existing list so that it will contain only a specified range of elements. * * @param string $key * @param int $start * @param int $stop * * @return bool FALSE if the key identify a non-list value. * @link http://redis.io/commands/ltrim * @example * <pre> * $redis->rPush('key1', 'A'); * $redis->rPush('key1', 'B'); * $redis->rPush('key1', 'C'); * $redis->lRange('key1', 0, -1); // array('A', 'B', 'C') * $redis->lTrim('key1', 0, 1); * $redis->lRange('key1', 0, -1); // array('A', 'B') * </pre> */ public function lTrim($key, $start, $stop) { $this->appendToLog('LTRIM ' . $key . ' ' . $start . ' ' . $stop); return $this->client->lTrim($key, $start, $stop); }