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


PHP Redis::del方法代码示例

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


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

示例1: del

 public function del($key)
 {
     if (!$this->isConnected()) {
         return false;
     }
     return (bool) $this->redis->del($key);
 }
开发者ID:everlution,项目名称:redlock,代码行数:7,代码来源:PhpRedisAdapter.php

示例2: get

 public function get($key, $top = 10)
 {
     $result_key = $this->result_prefix . $key;
     $this->redis->zInter($result_key, [$this->key_prefix . $key, $this->word_prefix], [1, 1]);
     $result = $this->redis->zRevRange($result_key, 0, $top, true);
     $this->redis->del($result_key);
     return $result;
 }
开发者ID:sinopex,项目名称:self-learning-project,代码行数:8,代码来源:Suggest.php

示例3: releaseLock

 /**
  * {@inheritdoc}
  */
 public function releaseLock($name)
 {
     if (isset($this->locks[$name]) && $this->redis->del($name)) {
         $this->clearLock($name);
         return true;
     }
     return false;
 }
开发者ID:ixarlie,项目名称:mutex-bundle,代码行数:11,代码来源:RedisLock.php

示例4: clear

 public function clear()
 {
     $this->redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_NONE);
     $prefix = $this->redis->getOption(\Redis::OPT_PREFIX);
     $offset = strlen($prefix);
     $keys = $this->redis->keys('*');
     foreach ($keys as $key) {
         $this->redis->del(substr($key, $offset));
     }
 }
开发者ID:rybakit,项目名称:phive-queue,代码行数:10,代码来源:RedisHandler.php

示例5: disable_feature

 /**
  * Disable a dark launch feature
  * @param $feature string - The name of the feature
  */
 public function disable_feature($feature_name)
 {
     $multi = $this->redis->multi();
     $this->redis->del("{$this->feature_namespace()}:feature:{$feature_name}");
     $this->redis->srem("{$this->feature_namespace()}:features", $feature_name);
     $multi->exec();
 }
开发者ID:stevenharradine,项目名称:php-dark-launch,代码行数:11,代码来源:Dark_Launch.php

示例6: tearDown

 /**
  * Delete the keys that were added to the database during the test
  */
 public function tearDown()
 {
     parent::tearDown();
     Redis::del($this->testingResource->testModelHashId);
     Redis::del($this->testingResource->testModelSearchableId);
     Redis::del("testmodels");
 }
开发者ID:ryuske,项目名称:redismodel,代码行数:10,代码来源:CreateResourceTest.php

示例7: release_lock

 /**
  * Releases a given lock if the owner information matches.
  *
  * @see cache_is_lockable
  * @param string $key Name of the lock to release.
  * @param string $ownerid Owner information to use.
  * @return bool True if the lock is released, false if it is not.
  */
 public function release_lock($key, $ownerid)
 {
     if ($this->check_lock_state($key, $ownerid)) {
         return $this->redis->del($key) !== false;
     }
     return false;
 }
开发者ID:lucaboesch,项目名称:moodle,代码行数:15,代码来源:lib.php

示例8: unlock

 public function unlock()
 {
     try {
         $this->rd->del($this->k);
     } catch (\RedisException $e) {
     }
 }
开发者ID:seepre,项目名称:api.seepre.com,代码行数:7,代码来源:RedSpinlock.php

示例9: unlock

 private function unlock()
 {
     if ($this->locked) {
         $this->redis->del($this->lockKey);
         $this->locked = false;
     }
 }
开发者ID:wikidi,项目名称:libw-http,代码行数:7,代码来源:RedisSessionHandler.php

示例10: removeWord

 /**
  * {@inheritDoc}
  */
 public function removeWord($language, $word)
 {
     $word = mb_strtolower($word, mb_detect_encoding($word));
     if ($this->redis->exists($word)) {
         $languages = unserialize($this->redis->get($word));
         if (false !== ($index = array_search($language, $languages))) {
             unset($languages[$index]);
             if (!count($languages)) {
                 $this->redis->del($word);
             } else {
                 $this->redis->set($word, serialize($languages));
             }
         }
     }
     return $this;
 }
开发者ID:jackblackjack,项目名称:LanguageDetector,代码行数:19,代码来源:RedisDictionary.php

示例11: flush

 /**
  * Deletes all items from cache.
  *
  * This should only be used for maintenance purposes (slow performance).
  */
 public function flush()
 {
     $keys = $this->redis->keys($this->redis->prefix('*'));
     foreach ($keys as $key) {
         $this->redis->del($key);
     }
 }
开发者ID:spiritix,项目名称:lada-cache,代码行数:12,代码来源:Cache.php

示例12: testUnserialize

 public function testUnserialize()
 {
     $vals = array(1, 1.5, 'one', array('this', 'is', 'an', 'array'));
     $serializers = array(Redis::SERIALIZER_PHP);
     if (defined('Redis::SERIALIZER_IGBINARY')) {
         $serializers[] = Redis::SERIALIZER_IGBINARY;
     }
     foreach ($serializers as $mode) {
         $vals_enc = array();
         // Pass them through redis so they're serialized
         foreach ($vals as $key => $val) {
             $this->redis->setOption(Redis::OPT_SERIALIZER, $mode);
             $key = "key" . ++$key;
             $this->redis->del($key);
             $this->redis->set($key, $val);
             // Clear serializer, get serialized value
             $this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);
             $vals_enc[] = $this->redis->get($key);
         }
         // Run through our array comparing values
         for ($i = 0; $i < count($vals); $i++) {
             // reset serializer
             $this->redis->setOption(Redis::OPT_SERIALIZER, $mode);
             $this->assertTrue($vals[$i] == $this->redis->_unserialize($vals_enc[$i]));
             $this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);
         }
     }
 }
开发者ID:stonegithubs,项目名称:phpredis,代码行数:28,代码来源:TestRedis.php

示例13: destroy

 /**
  * Destroy a session.
  * Expects a session id.
  * @param string $sessionId
  * @return boolean
  */
 public function destroy($sessionId = '')
 {
     if ($sessionId !== '' && $this->_redis->exists($this->_key($sessionId))) {
         $this->_redis->del($this->_key($sessionId));
     }
     session_destroy();
     return true;
 }
开发者ID:hubvioos,项目名称:42framework,代码行数:14,代码来源:RedisHandler.php

示例14: remove

 public function remove()
 {
     if (!$this->id) {
         return false;
     }
     Redis::del($this->key());
     Redis::zrem(get_class($this), $this->id);
 }
开发者ID:nickyleach,项目名称:OSTSurvey,代码行数:8,代码来源:RedisObject.php

示例15: clear

 protected static function clear(\Redis $redis)
 {
     $prefix = $redis->getOption(\Redis::OPT_PREFIX);
     $offset = strlen($prefix);
     $keys = $redis->keys('*');
     foreach ($keys as $key) {
         $redis->del(substr($key, $offset));
     }
 }
开发者ID:rybakit,项目名称:taskqueue,代码行数:9,代码来源:RedisQueueTest.php


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