本文整理匯總了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;
}
示例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