当前位置: 首页>>代码示例>>PHP>>正文


PHP ClientInterface::del方法代码示例

本文整理汇总了PHP中Predis\ClientInterface::del方法的典型用法代码示例。如果您正苦于以下问题:PHP ClientInterface::del方法的具体用法?PHP ClientInterface::del怎么用?PHP ClientInterface::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Predis\ClientInterface的用法示例。


在下文中一共展示了ClientInterface::del方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: release

 /**
  * Releases the lock, if it has not been released already
  */
 public function release()
 {
     if ($this->released) {
         return;
     }
     // Only release the lock if it hasn't expired
     if ($this->expire >= time()) {
         $this->redis->del($this->key);
     }
     $this->released = true;
 }
开发者ID:splitice,项目名称:php-redis-locking,代码行数:14,代码来源:Lock.php

示例2: removeIndexId

 /**
  * Remove an ID from an index
  * @param  string $id
  * @param  string $index
  * @return void
  */
 protected function removeIndexId(string $id, string $index)
 {
     if ($this->redis->scard($index) == 1) {
         return $this->redis->del($index);
     }
     return $this->redis->srem($index, $id);
 }
开发者ID:phparmory,项目名称:autocomplete,代码行数:13,代码来源:RedisRepository.php

示例3: preRequestHandle

 /**
  * @param SessionInterface $session
  * @param Request $request
  */
 private function preRequestHandle(SessionInterface $session, Request $request)
 {
     $id = $request->cookie($this->key);
     $key = 'session:' . $id;
     if (!Str::equals($key, $session->getId())) {
         $this->redis->del($key);
         return;
     }
     $value = $this->redis->get('session:' . $key);
     $content = Json::parse($value);
     if ($content['last_seen'] > $session->get('last_seen')) {
         foreach ($content as $key => $value) {
             if (!Str::startsWith($key, ['_', 'login_'])) {
                 $session->set($key, $value);
             }
         }
     }
 }
开发者ID:spyc,项目名称:elearn-foundation,代码行数:22,代码来源:CommonSession.php

示例4: release

 /**
  * Release the lock if we possess it.
  *
  * Returns true if we released the lock, and false if it was already
  * released.
  *
  * @return bool
  */
 public function release()
 {
     if (!$this->locked()) {
         return false;
     }
     $this->redis->del($this->name);
     $this->state = self::UNLOCKED;
     return true;
 }
开发者ID:AltThree,项目名称:Locker,代码行数:17,代码来源:Lock.php

示例5: clear

 /**
  * Delete all keys from the cache
  *
  * @param bool $check if true will check expiration, otherwise delete all
  * @return bool True if the cache was successfully cleared, false otherwise
  */
 public function clear($check)
 {
     if ($check) {
         return true;
     }
     $keys = $this->client->keys($this->_config['prefix'] . '*');
     foreach ($keys as $key) {
         $this->client->del($key);
     }
     return true;
 }
开发者ID:renan,项目名称:cakephp-predis,代码行数:17,代码来源:PredisEngine.php

示例6: deleteGlob

 private function deleteGlob($pattern)
 {
     $keys = $this->client->keys($pattern);
     $options = $this->client->getOptions();
     if (isset($options->prefix)) {
         $length = strlen($options->prefix->getPrefix());
         $keys = array_map(function ($key) use($length) {
             return substr($key, $length);
         }, $keys);
     }
     if (count($keys) === 0) {
         return;
     }
     $this->client->del($keys);
 }
开发者ID:genkgo,项目名称:cache,代码行数:15,代码来源:PredisAdapter.php

示例7: testSet

 /**
  * @group redis-strings
  */
 public function testSet()
 {
     $this->assertEquals('OK', $this->client->set('foo', 'bar'));
     $this->assertEquals('OK', $this->client->set('foo', 'baz'));
     $this->assertSame('baz', $this->client->get('foo'));
     // EX expire time
     $this->assertEquals('OK', $this->client->set('foo', 'bar', 'EX', 20));
     $this->assertThat($this->client->ttl('foo'), $this->logicalAnd($this->greaterThan(0), $this->lessThanOrEqual(20)));
     // PX expire time
     $this->client->del('foo');
     $this->assertEquals('OK', $this->client->set('foo', 'bar', 'PX', 20000));
     $this->assertThat($this->client->ttl('foo'), $this->logicalAnd($this->greaterThan(0), $this->lessThanOrEqual(20)));
     $this->client->del('foo');
     $this->assertNull($this->client->set('foo', 'bar', 'XX'));
     $this->assertEquals('OK', $this->client->set('foo', 'baz', 'NX'));
     $this->assertNull($this->client->set('foo', 'blue', 'NX'));
     $this->assertEquals('OK', $this->client->set('foo', 'red', 'XX'));
 }
开发者ID:gmo,项目名称:cache,代码行数:21,代码来源:PredisTest.php

示例8: destroy

 /**
  * {@inheritdoc}
  */
 public function destroy($sessionId)
 {
     $this->redis->del($sessionId);
     return true;
 }
开发者ID:robbert-vdh,项目名称:bolt,代码行数:8,代码来源:RedisHandler.php

示例9: doDelete

 /**
  * {@inheritdoc}
  */
 protected function doDelete($id)
 {
     return $this->client->del($id) >= 0;
 }
开发者ID:zqcloveping,项目名称:pagekit,代码行数:7,代码来源:PredisCache.php

示例10: deleteMulti

 /**
  * @param array $keys
  *
  * @return void
  */
 public function deleteMulti(array $keys)
 {
     $this->client->del($keys);
     $this->addMultiDeleteAccessStats($keys);
 }
开发者ID:spryker,项目名称:Storage,代码行数:10,代码来源:Service.php

示例11: del

 /**
  * {@inheritDoc}
  */
 public function del($key)
 {
     return $this->predis->del($key);
 }
开发者ID:php-resque,项目名称:resque,代码行数:7,代码来源:PredisBridge.php

示例12: destroy

 /**
  * Destroy Session - remove data from resource for
  * given session id
  * @param string $id
  * @return void
  */
 public function destroy($id)
 {
     $this->redisClient->del($id);
 }
开发者ID:dnoegel,项目名称:SWRedis,代码行数:10,代码来源:SaveHandler.php


注:本文中的Predis\ClientInterface::del方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。