本文整理汇总了PHP中Predis\Client::del方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::del方法的具体用法?PHP Client::del怎么用?PHP Client::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predis\Client
的用法示例。
在下文中一共展示了Client::del方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: del
/**
* @param $name
*/
public function del($name)
{
if (isset($this->buffer[$name])) {
unset($this->buffer[$name]);
}
$this->client->del($name);
}
示例2: flushIndex
public function flushIndex()
{
if ($this->indexing) {
$this->store->del("{$this->prefix}::index");
}
return parent::flushIndex();
}
示例3: delete
/**
* Remove values from cache
*
* @param array $keys list of keys to delete
*
* @return boolean true on success, false on failure
*/
protected function delete(array $keys)
{
foreach ($keys as $k) {
$k = sha1($k);
$this->redis->del($k);
}
return true;
}
示例4: deleteItems
/**
* @param array $keys
* @return bool
*/
public function deleteItems(array $keys)
{
$return = $this->client->del($keys);
if ($return > 0) {
return true;
}
return false;
}
示例5: remove
/**
* @param $key
* @throws UnavailableException
*/
public function remove($key)
{
try {
$this->client->del([$key]);
} catch (ServerException $ex) {
throw new UnavailableException($ex->getMessage());
}
}
示例6: popItem
/**
* @param $queueName
* @return QueueItemInterface
*/
public function popItem($queueName)
{
$this->getKeys($queueName, true);
$key = array_pop($this->keys);
$itemRaw = $this->redis->get($key);
$item = unserialize($itemRaw);
$this->redis->del($key);
return $item;
}
示例7: count
/**
* {@inheritDoc}
*/
public function count(array $sources)
{
call_user_func_array([$this->redis, 'zunionstore'], array_merge([$key = sha1(microtime()), count($sources)], array_map(function ($source) {
return "aggregator:sources:{$source}";
}, $sources)));
$count = $this->redis->zcard($key);
$this->redis->del($key);
return $count;
}
示例8: delete
/**
* {@inheritdoc}
*/
protected function delete(array $keys)
{
try {
$this->client->del($keys);
} catch (\Predis\Response\ServerException $e) {
return false;
}
return true;
}
示例9: lookupKeyInRedisDatabase
/**
* Checks if the activation key is present in the redis database.
*
* @param string $activationKey
*
* @return bool
*/
private function lookupKeyInRedisDatabase($activationKey)
{
$persistentKey = $this->generateRedisKeyByApprovalKey($activationKey);
$exists = $this->redis->exists($persistentKey);
// the key is not needed anymore because the approval validation will be triggered once only.
if ($exists) {
$this->redis->del($persistentKey);
}
return $exists;
}
示例10: recheck
/**
* @inheritdoc
*/
public function recheck($event)
{
$value = $this->client->get($event);
if (!$value) {
return;
}
foreach ($this->listeners[$event] ?? [] as $listener) {
$listener($value);
}
$this->client->del([$event]);
}
示例11: logout
public function logout()
{
$userId = $this->session->get('userId');
$newAuthSecret = $this->getRand();
$oldAuthSecret = $this->redisClient->get("uid:{$userId}:auth");
$this->redisClient->set("uid:{$userId}:auth", $newAuthSecret);
$this->redisClient->set("auth:{$newAuthSecret}", $userId);
$this->redisClient->del("auth:{$oldAuthSecret}");
$this->session->set('userId', null);
$this->session->set('username', null);
}
示例12: removeWithName
/**
* @param $key
*
* @return int
*/
public function removeWithName($key)
{
$result = 0;
// se key ha l'asterisco, cancella tutte le chiavi che iniziano per il prefisso in $key
if (strpos($key, '*') !== false) {
foreach ($this->redis->keys($key) as $k) {
$result += $this->redis->del($k);
}
} else {
$result += $this->redis->del($key);
}
return $result;
}
示例13: clearQueue
public function clearQueue($stub)
{
for ($x = 0; $x < 10; $x++) {
$iterator = new Iterator\Keyspace($this->redisClient, $stub . "*", 200);
$keysToDelete = [];
foreach ($iterator as $key) {
$keysToDelete[] = $key;
}
if (count($keysToDelete)) {
$this->redisClient->del($keysToDelete);
}
}
}
示例14: revokeAccess
/**
*
*/
private function revokeAccess()
{
$accessToken = $this->redis->get(self::REDIS_ACCESS_TOKEN);
$this->redis->del(self::REDIS_ACCESS_TOKEN);
$this->redis->del(self::REDIS_REFRESH_TOKEN);
$this->googleClient->revokeToken($accessToken);
}
示例15: invalidate
/**
* @param string $providerPrefix
*
* @return bool
*/
public function invalidate($providerPrefix)
{
$keys = $this->client->keys($this->prefix . strtolower($providerPrefix) . '_*');
foreach ($keys as $key) {
$this->client->del($key);
}
return true;
}