Example #1
0
 public function removeFromSet($key, $value)
 {
     if (!is_array($value)) {
         $value = array($value);
     }
     return $this->_client->srem($key, $value);
 }
Example #2
0
 /**
  * @param $namespaceKey
  */
 private function unsetRegistryValue($namespaceKey)
 {
     if (($key = array_search($namespaceKey, $this->registeredStates, true)) !== false) {
         unset($this->registeredStates[$key]);
     }
     $this->redis->srem(self::STATE_MACHINE_NAMESPACE . 'registry', $namespaceKey);
 }
 /**
  * Wait for a message in the queue and save the message to a safety queue
  *
  * TODO: Idea for implementing a TTR (time to run) with monitoring of safety queue. E.g.
  * use different queue names with encoded times? With brpoplpush we cannot modify the
  * queued item on transfer to the safety queue and we cannot update a timestamp to mark
  * the run start time in the message, so separate keys should be used for this.
  *
  * @param int $timeout
  * @return \Flowpack\JobQueue\Common\Queue\Message
  */
 public function waitAndReserve($timeout = NULL)
 {
     if ($timeout === NULL) {
         $timeout = $this->defaultTimeout;
     }
     try {
         $value = $this->client->brpoplpush("queue:{$this->name}:messages", "queue:{$this->name}:processing", $timeout);
     } catch (\Exception $e) {
         $this->waitAndReserve();
     }
     if (is_string($value)) {
         $message = $this->decodeMessage($value);
         if ($message->getIdentifier() !== NULL) {
             $this->client->srem("queue:{$this->name}:ids", $message->getIdentifier());
         }
         return $message;
     } else {
         return NULL;
     }
 }
Example #4
0
 /**
  * @inheritdoc
  */
 public function removeFromList($list, $value)
 {
     return $this->predis->srem($list, $value) > 0;
 }
 /**
  * Remove identifier from set
  * @param $identifier
  * @return int
  */
 public function remove($identifier)
 {
     return $this->redisClient->srem($this->setName, $identifier);
 }
Example #6
0
 /**
  * Removes the command from the subscription set.
  *
  * @param string $commandName
  */
 public function unsubscribe($commandName)
 {
     $this->client->srem(sprintf(self::COMMAND_SUBSCRIPTION_KEY, $this->hashCommandName($commandName)), [$this->nodeName]);
 }
 /**
  * @param int $userId
  */
 private function unfollow($userId)
 {
     $this->redisClient->srem("uid:" . $userId . ":followers", [$this->sessionUserId]);
     $this->redisClient->srem("uid:" . $this->sessionUserId . ":following", [$userId]);
 }
 /**
  * @param int $keyId
  * @param int $searchId
  * @return $this;
  */
 private function removeFromSet($keyId, $searchId)
 {
     $this->redis->srem($this->getFormattedKey($keyId), $searchId);
     return $this;
 }