/** * Deletes all keys from associated tags and all priorities * * @todo optimize * @param string $keys */ private function cleanEntry($keys) { foreach (is_array($keys) ? $keys : [$keys] as $key) { $entries = $this->entryTags($key); $this->client->multi(); foreach ($entries as $tag) { $this->client->sRem($this->formatKey($tag, self::KEYS), $key); } // drop tags of entry and priority, in case there are some $this->client->del($this->formatKey($key, self::TAGS), $this->formatKey($key, self::PRIORITY)); $this->client->zRem($this->formatKey(self::PRIORITY), $key); $this->client->exec(); } }
/** * @param string $queue * @return QueueManager */ public function clearQueue($queue) { $this->redis->multi(); $this->redis->sRem(self::QUEUE_KEY, $queue); $this->redis->lTrim($this->formatQueueKey($queue), 1, 0); $this->redis->exec(); return $this; }