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


PHP Memcached::getAllKeys方法代码示例

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


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

示例1: listKeys

 /**
  * @see parent::listKeys()
  */
 function listKeys($prefix)
 {
     // Memcached 2.0+
     if (method_exists($this->conn, "getAllKeys")) {
         return $this->conn->getAllKeys();
     }
     return array();
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:11,代码来源:MemcachedSharedMemory.class.php

示例2: clear

 public function clear($prefix = '')
 {
     $prefix = $this->getNamespace() . $prefix;
     $allKeys = self::$cache->getAllKeys();
     $keys = array();
     $prefixLength = strlen($prefix);
     foreach ($allKeys as $key) {
         if (substr($key, 0, $prefixLength) === $prefix) {
             $keys[] = $key;
         }
     }
     self::$cache->deleteMulti($keys);
     return true;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:14,代码来源:memcached.php

示例3: clear

 public function clear($prefix = '')
 {
     $prefix = $this->getNamespace() . $prefix;
     $allKeys = self::$cache->getAllKeys();
     if ($allKeys === false) {
         // newer Memcached doesn't like getAllKeys(), flush everything
         self::$cache->flush();
         return true;
     }
     $keys = array();
     $prefixLength = strlen($prefix);
     foreach ($allKeys as $key) {
         if (substr($key, 0, $prefixLength) === $prefix) {
             $keys[] = $key;
         }
     }
     if (method_exists(self::$cache, 'deleteMulti')) {
         self::$cache->deleteMulti($keys);
     } else {
         foreach ($keys as $key) {
             self::$cache->delete($key);
         }
     }
     return true;
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:25,代码来源:Memcached.php

示例4: mem

 public function mem()
 {
     //$CI =& get_instance();
     $m = new Memcached();
     $m->addServer('localhost', 11211);
     $res = $m->getAllKeys();
     print_r($res);
 }
开发者ID:vovax3m,项目名称:dev,代码行数:8,代码来源:Purchase.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->_Memcached->getAllKeys();
     foreach ($keys as $key) {
         if (strpos($key, $this->_config['prefix']) === 0) {
             $this->_Memcached->delete($key);
         }
     }
     return true;
 }
开发者ID:Obo-project,项目名称:obo-project,代码行数:19,代码来源:MemcachedEngine.php

示例6: keys

 public static function keys(\Memcached $memcached, $regex = false)
 {
     $allKeys = $memcached->getAllKeys();
     if (!$regex) {
         return $allKeys;
     }
     $matchingKeys = [];
     foreach ($allKeys as $key) {
         if (preg_match($regex, $key) > 0) {
             array_push($matchingKeys, $key);
         }
     }
     return $matchingKeys;
 }
开发者ID:joelvardy,项目名称:memcachedtool,代码行数:14,代码来源:Keys.php

示例7: delete

 /**
  * Delete one or several data from cache (* joker can be used, but avoid it !)
  * 	E.g.: delete('*'); delete('my_prefix_*'); delete('my_key_name');
  *
  * @param string $key
  * @return bool
  */
 public function delete($key)
 {
     if ($key == '*') {
         $this->flush();
     } elseif (strpos($key, '*') === false) {
         $this->_delete($key);
     } else {
         $pattern = str_replace('\\*', '.*', preg_quote($key));
         $keys = $this->memcached->getAllKeys();
         foreach ($keys as $key => $data) {
             if (preg_match('#^' . $pattern . '$#', $key)) {
                 $this->_delete($key);
             }
         }
     }
     return true;
 }
开发者ID:nmardones,项目名称:PrestaShop,代码行数:24,代码来源:CacheMemcached.php

示例8: flushImpl

    protected function flushImpl($cacheSubsetName) {
        if (isset($cacheSubsetName)) {
            $cacheEntryNames = $this->memcached->getAllKeys();
            if ($cacheEntryNames === FALSE) {
                return  FALSE;
            }

            $result = TRUE;
            foreach ($cacheEntryNames as $cacheEntryName) {
                if ($this->inSubset($cacheSubsetName, $cacheEntryName)) {
                    $result = $this->memcached->delete($cacheEntryName) && $result;
                }
            }

            return $result;

        }
        else {
            return $this->memcached->flush();
        }
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:21,代码来源:MemcachedHandler.php

示例9: _getAllKeys

 /**
  * {@inheritDoc}
  *
  * @see http://php.net/manual/en/memcached.getallkeys.php
  */
 protected function _getAllKeys()
 {
     return $this->_connection->getAllKeys();
 }
开发者ID:behance,项目名称:nbd.php-cache,代码行数:9,代码来源:MemcachedAdapter.php

示例10: Memcached

<?php

$m = new Memcached();
$m->addServer('localhost', 11211);
// getAllKeys doesn't seem to work until after another operation
$m->get('a');
$keys = $m->getAllKeys();
if ($keys) {
    array_map(function ($key) use($m) {
        $m->delete($key);
    }, $keys);
}
var_dump($m->getAllKeys());
$obj = new stdclass();
$obj->int = 99;
$obj->string = 'a simple string';
$obj->array = array(11, 22);
$m->set('int', 99);
$m->set('string', 'a simple string');
$m->set('array', array(11, 12));
$m->set('object', $obj);
var_dump($m->getAllKeys());
开发者ID:badlamer,项目名称:hhvm,代码行数:22,代码来源:memcached-getallkeys.php

示例11: get_prefixed_keys

 /**
  * Returns all of the keys in the given connection that belong to this cache store instance.
  *
  * Requires php memcached extension version 2.0.0 or greater.
  *
  * @param Memcached $connection
  * @param string $prefix
  * @return array
  */
 protected static function get_prefixed_keys(Memcached $connection, $prefix)
 {
     $connkeys = $connection->getAllKeys();
     if (empty($connkeys)) {
         return array();
     }
     $keys = array();
     $start = strlen($prefix);
     foreach ($connkeys as $key) {
         if (strpos($key, $prefix) === 0) {
             $keys[] = substr($key, $start);
         }
     }
     return $keys;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:24,代码来源:lib.php

示例12: trim

            $listKeys = true;
            // key
        } else {
            $key = trim($arg);
        }
    }
}
$mc = new Memcached();
$mc->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
$mc->setOption(\Memcached::OPT_DISTRIBUTION, \Memcached::DISTRIBUTION_CONSISTENT);
$mc->addServer($host, $port);
$keys = [];
if ($key && strpos($key, '*') === false) {
    $keys[] = $key;
} else {
    $allKeys = $mc->getAllKeys();
    if (strpos($key, '*') !== false) {
        $keyPattern = '/^' . str_replace('*', '.*', $key) . '$/i';
        foreach ($allKeys as $k) {
            if (preg_match($keyPattern, $k)) {
                $keys[] = $k;
            }
        }
    } elseif ($listKeys) {
        $keys = $allKeys;
    }
}
foreach ($keys as $key) {
    if ($listKeys) {
        echo $key . PHP_EOL;
    } else {
开发者ID:gegok,项目名称:php-client-tools,代码行数:31,代码来源:memcached.php

示例13: getAllKeys

 /**
  * tüm memcache key'lerini get eder
  * @return array
  */
 public function getAllKeys()
 {
     return $this->memcache->getAllKeys();
 }
开发者ID:QRMarket,项目名称:PHP,代码行数:8,代码来源:CacheAbstract.class.php

示例14: cleancache

 function cleancache($uid)
 {
     $m = new Memcached();
     $m->addServer('localhost', 11211);
     $r = $m->getAllKeys();
     $m->delete($uid . 'CE');
     $m->delete('dates' . $uid);
     $m->delete($uid . 'ext');
     $m->delete($uid . 'saldo');
     echo 1;
 }
开发者ID:vovax3m,项目名称:lk,代码行数:11,代码来源:Ajax.php

示例15: getAllKeys

 /**
  * @inheritdoc
  */
 public function getAllKeys()
 {
     return $this->storage->getAllKeys();
 }
开发者ID:romeoz,项目名称:rock-cache,代码行数:7,代码来源:Memcached.php


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