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


PHP Memcache::getAllKeys方法代码示例

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


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

示例1: clear

 /**
  * Delete all keys from the cache
  *
  * @param bool $check If true no deletes will occur and instead CakePHP will rely
  *   on key TTL values.
  * @return bool True if the cache was successfully cleared, false otherwise
  */
 public function clear($check)
 {
     if ($check) {
         return true;
     }
     $keys = $this->_Memcached->getAllKeys();
     foreach ($keys as $key) {
         if (strpos($key, $this->settings['prefix']) === 0) {
             $this->_Memcached->delete($key);
         }
     }
     return true;
 }
开发者ID:hupla78,项目名称:Nadia,代码行数:20,代码来源:MemcachedEngine.php

示例2: delete_all

 /**
  * Delete all cache entries.
  *
  * Beware of using this method when
  * using shared memory cache systems, as it will wipe every
  * entry within the system for all clients.
  *
  *     // Delete all cache entries in the default group
  *     Cache::instance('memcached')->delete_all();
  *
  * @return  boolean
  */
 public function delete_all($filter = FALSE)
 {
     if ($filter === FALSE) {
         $result = $this->_memcached->flush();
         // We must sleep after flushing, or overwriting will not work!
         // @see http://php.net/manual/en/function.memcached-flush.php#81420
         sleep(1);
         return $result;
     } else {
         $keys = $this->_memcached->getAllKeys();
         foreach ($keys as $key) {
             if (strpos($key, $filter) === 0) {
                 $this->_memcached->delete($key);
             }
         }
     }
 }
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:29,代码来源:Memcached.php


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