redis()->lPush($this->getCacheKey(), ...$value); } /** * 获取队列中的任务 * * @return bool|mixed */ public function pop() { return $this->redis()->rPop($this->getCacheKey()); } /** * 获取列表中元素总数 * * @return int */ public function count(): int { return (int)$this->redis()->lLen($this->getCacheKey()); } /** * 清除列表中所有元素 * * @return boolean */ public function clear(): bool { return $this->redis()->lTrim($this->getCacheKey(), 1, 0); } /** * 获取列表中所有元素 * * @return array */ public function all(): array { return $this->redis()->lRange($this->getCacheKey(), 0, -1); } /** * 删除 List * * @return bool */ public function delete(): bool { return (bool)$this->redis()->del($this->getCacheKey()); } }