Exemplo n.º 1
0
 /**
  * @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;
 }
Exemplo n.º 2
0
 /**
  * @param string $id
  *
  * @return bool
  */
 public function destroy($id)
 {
     if (!isset($this->ssIds[$id])) {
         return FALSE;
     }
     $key = $this->formatKey($id);
     $this->client->multi(function (RedisClient $client) use($key) {
         $client->del($key);
         $client->unlock($key);
     });
     return TRUE;
 }
 /**
  * @param string $id
  *
  * @return bool
  */
 public function remove($id)
 {
     try {
         $key = $this->formatKey($id);
         $this->client->multi(function (RedisClient $client) use($key) {
             $client->del($key);
             $client->unlock($key);
         });
         unset($this->ssIds[$key]);
         return TRUE;
     } catch (Exception $e) {
         Debugger::log($e, 'redis-session');
         return FALSE;
     }
 }
Exemplo n.º 4
0
 /**
  * Cleans entries from journal.
  *
  * @param  array  $conds
  *
  * @return array of removed items or NULL when performing a full cleanup
  */
 public function clean(array $conds)
 {
     if (!empty($conds[Cache::ALL])) {
         $all = $this->client->keys(self::NS_NETTE . ':*');
         $this->client->multi();
         call_user_func_array([$this->client, 'del'], $all);
         $this->client->exec();
         return NULL;
     }
     $entries = [];
     if (!empty($conds[Cache::TAGS])) {
         foreach ((array) $conds[Cache::TAGS] as $tag) {
             $this->cleanEntry($found = $this->tagEntries($tag));
             $entries = array_merge($entries, $found);
         }
     }
     if (isset($conds[Cache::PRIORITY])) {
         $this->cleanEntry($found = $this->priorityEntries($conds[Cache::PRIORITY]));
         $entries = array_merge($entries, $found);
     }
     return array_unique($entries);
 }