/** * @param string $queue * @param Message $message * @return QueueManager */ public function publishMessage($queue, Message $message) { $this->redis->multi(); $this->redis->sAdd('queues', $queue); $this->redis->rPush($this->formatQueueKey($queue), json_encode($message)); $this->redis->exec(); return $this; }
/** * Writes entry information into the journal. * * @param string $key * @param array $dp * * @return void */ public function write($key, array $dp) { $this->cleanEntry($key); $this->client->multi(); // add entry to each tag & tag to entry $tags = empty($dp[Cache::TAGS]) ? [] : (array) $dp[Cache::TAGS]; foreach (array_unique($tags) as $tag) { $this->client->sAdd($this->formatKey($tag, self::KEYS), $key); $this->client->sAdd($this->formatKey($key, self::TAGS), $tag); } if (isset($dp[Cache::PRIORITY])) { $this->client->zAdd($this->formatKey(self::PRIORITY), $dp[Cache::PRIORITY], $key); } $this->client->exec(); }