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


PHP Memcached::fetchAll方法代码示例

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


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

示例1: fetchAll

 /**
  * FetchAll
  *
  * @throws Exception
  * @return array
  */
 public function fetchAll()
 {
     $result = $this->memcached->fetchAll();
     if ($result === false) {
         throw new Exception\RuntimeException("Memcached::fetchAll() failed");
     }
     $select = $this->stmtOptions['select'];
     foreach ($result as &$elem) {
         if (!in_array('key', $select)) {
             unset($elem['key']);
         }
     }
     return $result;
 }
开发者ID:ranxin1022,项目名称:zf2,代码行数:20,代码来源:Memcached.php

示例2: setUp

 public function setUp()
 {
     if (!class_exists('\\Memcached', true)) {
         $this->markTestSkipped('Memcached is not installed');
     }
     $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
     // setup the default timeout (avoid max execution time)
     socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 1, 'usec' => 0));
     $result = @socket_connect($socket, '127.0.0.1', 11211);
     if (!$result) {
         $this->markTestSkipped('Memcached is not running');
     }
     socket_close($socket);
     $memcached = new \Memcached();
     $memcached->addServer('127.0.0.1', 11211);
     $memcached->fetchAll();
 }
开发者ID:sonata-project,项目名称:cache,代码行数:17,代码来源:MemcachedCounterTest.php

示例3: fetchAll

 /**
  * FetchAll
  * 
  * @throws Exception
  * @return array 
  */
 public function fetchAll()
 {
     $prefixL = strlen($this->stmtOptions['namespace'] . $this->getOptions()->getNamespaceSeparator());
     $result = $this->memcached->fetchAll();
     if ($result === false) {
         throw new Exception\RuntimeException("Memcached::fetchAll() failed");
     }
     $select = $this->stmtOptions['select'];
     foreach ($result as &$elem) {
         if (in_array('key', $select)) {
             $elem['key'] = substr($elem['key'], $prefixL);
         } else {
             unset($elem['key']);
         }
     }
     return $result;
 }
开发者ID:nevvermind,项目名称:zf2,代码行数:23,代码来源:Memcached.php

示例4: forget

 /**
  * Remove an item from the cache.
  *
  * @param  string  $key
  * @return bool
  */
 public function forget($key)
 {
     if ($key == '*') {
         $this->flush();
         return true;
     }
     $pattern = str_replace(['\\*', '*'], '.+', preg_quote($this->getPrefixWithLocale(true) . $key));
     $check = true;
     $all = $this->memcached->fetchAll();
     if ($all) {
         $check = false;
         foreach ($all as $cache) {
             if (preg_match('~^' . $pattern . '$~i', $cache['key'])) {
                 if (!$this->memcached->delete($cache['key'])) {
                     $check = false;
                 }
             }
         }
     }
     return $check;
 }
开发者ID:jooorooo,项目名称:cache,代码行数:27,代码来源:MemcachedStore.php

示例5: testFetchAllEmptyResults

 public function testFetchAllEmptyResults()
 {
     $memcached = new Memcached();
     $this->assertFalse($memcached->fetchAll());
 }
开发者ID:spudder-com,项目名称:spudder-django,代码行数:5,代码来源:MemcachedTest.php

示例6: Memcached

<?php

session_start();
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->set('key', 'value', time() + 30);
$m->delete('key1');
$m->fetchAll();
// var_dump($m);
$memcache = new Memcache();
$memcache->connect('localhost', 11211) or die("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: " . $version . "<br/>\n";
$tmp_object = new stdClass();
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;
$memcache->set('key', $tmp_object, false, 10) or die("Failed to save data at the server");
echo "Store data in the cache (data will expire in 10 seconds)<br/>\n";
$get_result = $memcache->get('key');
echo "Data from the cache:<br/>\n";
var_dump($get_result);
开发者ID:469306621,项目名称:Languages,代码行数:21,代码来源:memcached.php

示例7: fetchAll

 /**
  * Fetch all remaining results from the last request.
  *
  * @link http://www.php.net/manual/en/memcached.fetchall.php
  *
  * @return  array|bool          Returns the results or FALSE on failure.
  */
 public function fetchAll()
 {
     return $this->m->fetchAll();
 }
开发者ID:AlwaysOnline,项目名称:wordpress-pecl-memcached-object-cache,代码行数:11,代码来源:object-cache.php

示例8: getAll

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

示例9: fetchAll

 /**
  * Fetch all remaining results from the last request.
  *
  * @link http://www.php.net/manual/en/memcached.fetchall.php
  *
  * @return  array|bool          Returns the results or FALSE on failure.
  */
 public function fetchAll()
 {
     return $this->daemon->fetchAll();
 }
开发者ID:benediktharter,项目名称:wp-spider-cache,代码行数:11,代码来源:class-object-cache.php


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