當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。