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


PHP ClientInterface::keys方法代码示例

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


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

示例1: deleteGlob

 private function deleteGlob($pattern)
 {
     $keys = $this->client->keys($pattern);
     $options = $this->client->getOptions();
     if (isset($options->prefix)) {
         $length = strlen($options->prefix->getPrefix());
         $keys = array_map(function ($key) use($length) {
             return substr($key, $length);
         }, $keys);
     }
     if (count($keys) === 0) {
         return;
     }
     $this->client->del($keys);
 }
开发者ID:genkgo,项目名称:cache,代码行数:15,代码来源:PredisAdapter.php

示例2: 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->client->keys($this->_config['prefix'] . '*');
     foreach ($keys as $key) {
         $this->client->del($key);
     }
     return true;
 }
开发者ID:renan,项目名称:cakephp-predis,代码行数:17,代码来源:PredisEngine.php

示例3: testKeys

 /**
  * @group redis-keys
  */
 public function testKeys()
 {
     //$this->assertEquals(array(), $this->client->keys('derp'));
     $items = array('hello' => 1, 'hallo' => 1, 'hxllo' => 1, 'hllo' => 1, 'heeeello' => 1, 'hillo' => 1, 'hbllo' => 1, 'color:red' => 'red', 'color:blue' => 'blue', 'color:green' => 'green', '[ns]foo' => 'bar');
     $this->client->mset($items);
     $this->assertArraySimilar(array('hello', 'hallo', 'hxllo', 'hbllo', 'hillo'), $this->client->keys('h?llo'));
     $this->assertArraySimilar(array('hllo', 'hello', 'hallo', 'hxllo', 'hillo', 'hbllo', 'heeeello'), $this->client->keys('h*llo'));
     $this->assertArraySimilar(array('hello', 'hallo'), $this->client->keys('h[ae]llo'));
     $this->assertArraySimilar(array('hallo', 'hillo', 'hbllo', 'hxllo'), $this->client->keys('h[^e]llo'));
     $this->assertArraySimilar(array('hallo', 'hbllo'), $this->client->keys('h[a-b]llo'));
     $this->assertArraySimilar(array('color:green'), $this->client->keys('*en'));
     $this->assertArraySimilar(array('[ns]foo'), $this->client->keys('\\[ns\\]*'));
     $this->assertArraySimilar(array('color:red'), $this->client->keys('color:red'));
     $this->assertArraySimilar(array_keys($items), $this->client->keys('*'));
 }
开发者ID:gmo,项目名称:cache,代码行数:18,代码来源:PredisTest.php

示例4: getCountItems

 /**
  * @return int
  */
 public function getCountItems()
 {
     return count($this->client->keys($this->getSearchPattern()));
 }
开发者ID:spryker,项目名称:Storage,代码行数:7,代码来源:Service.php


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