當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。