當前位置: 首頁>>代碼示例>>PHP>>正文


PHP zend_shm_cache_fetch函數代碼示例

本文整理匯總了PHP中zend_shm_cache_fetch函數的典型用法代碼示例。如果您正苦於以下問題:PHP zend_shm_cache_fetch函數的具體用法?PHP zend_shm_cache_fetch怎麽用?PHP zend_shm_cache_fetch使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了zend_shm_cache_fetch函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test

 /**
  * Test if a cache is available or not (for the given id)
  *
  * @param  string $id cache id
  * @return mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
  */
 public function test($id)
 {
     $tmp = zend_shm_cache_fetch($this->_options['namespace'] . '::' . $id);
     if ($tmp !== null && $tmp !== false) {
         return true;
     }
     return false;
 }
開發者ID:nstapelbroek,項目名稱:Glitch_Lib,代碼行數:14,代碼來源:ZendShMem.php

示例2: fetch

 public function fetch($key)
 {
     $data = zend_shm_cache_fetch("MongoObject::{$key}");
     if ($data === false) {
         $data = null;
     }
     return $data;
 }
開發者ID:dintel,項目名稱:mongo-object,代碼行數:8,代碼來源:ZendDataCacheShm.php

示例3: _get

 protected function _get($key)
 {
     $data = zend_shm_cache_fetch($this->key($key));
     if ($data === null) {
         return self::NOT_FOUND;
     }
     return $data;
 }
開發者ID:liulingfu,項目名稱:madserve,代碼行數:8,代碼來源:ZendSHM.php

示例4: driverRead

 /**
  * @param \Psr\Cache\CacheItemInterface $item
  * @return mixed
  */
 protected function driverRead(CacheItemInterface $item)
 {
     $data = zend_shm_cache_fetch($item->getKey());
     if ($data === false) {
         return null;
     }
     return $data;
 }
開發者ID:jigoshop,項目名稱:Jigoshop2,代碼行數:12,代碼來源:Driver.php

示例5: _getExternal

 /**
  * @see SugarCacheAbstract::_getExternal()
  */
 protected function _getExternal($key)
 {
     $raw_cache_value = zend_shm_cache_fetch($key);
     if ($raw_cache_value === false) {
         return null;
     }
     return is_string($raw_cache_value) ? unserialize($raw_cache_value) : $raw_cache_value;
 }
開發者ID:omusico,項目名稱:sugar_work,代碼行數:11,代碼來源:SugarCacheZend.php

示例6: get

 function get($key)
 {
     $value = parent::get($key);
     if (!is_null($value)) {
         return $value;
     }
     $raw_cache_value = zend_shm_cache_fetch($this->_realKey($key));
     $cache_value = is_string($raw_cache_value) ? unserialize($raw_cache_value) : $raw_cache_value;
     return $this->_processGet($key, $cache_value);
 }
開發者ID:aldridged,項目名稱:gtg-sugar,代碼行數:10,代碼來源:SugarCache_ZendServer.php

示例7: geturl

 /**
  * 獲取遠程URL,並帶緩存$url是URL,time是緩時間,秒為單位,默認300
  */
 public static function geturl($url, $time = 300)
 {
     $md5 = md5($url);
     $cached = zend_shm_cache_fetch($md5);
     //從內存緩存讀取
     if ($cached === false || !empty($_GET['update'])) {
         $cached = file_get_contents($url);
         zend_shm_cache_store($md5, $cached, $time);
         //存至內存,最後一個是過期時間,單位為秒
         return $cached;
     } else {
         return $cached;
     }
 }
開發者ID:bobwuyan,項目名稱:testproject,代碼行數:17,代碼來源:common.php

示例8: _doContains

 /**
  * {@inheritdoc}
  */
 protected function _doContains($id)
 {
     return zend_shm_cache_fetch($id) !== FALSE;
 }
開發者ID:Golgarud,項目名稱:blizzard-api,代碼行數:7,代碼來源:ZendDataCache.php

示例9: get

 /**
  * Get a cache variable
  *
  * Retrieve a variable from the cache and return it's
  * value to the user.
  *
  * @param  string $name  The name of the cache variable to retrieve.
  *
  * @return mixed         The value of the retrieved variable or false if
  *                       variable isn't found.
  */
 public function get($name)
 {
     return zend_shm_cache_fetch($name);
 }
開發者ID:crlang44,項目名稱:frapi,代碼行數:15,代碼來源:Zendshm.php

示例10: zdcFetchMulti

 /**
  * Fetch multiple items from Zend Data SHM Cache
  *
  * @param  array $internalKeys
  * @return array All found items
  * @throws Exception\RuntimeException
  */
 protected function zdcFetchMulti(array $internalKeys)
 {
     $items = zend_shm_cache_fetch($internalKeys);
     if ($items === false) {
         throw new Exception\RuntimeException("zend_shm_cache_fetch(<array>) failed");
     }
     return $items;
 }
開發者ID:Baft,項目名稱:Zend-Form,代碼行數:15,代碼來源:ZendServerShm.php

示例11: get

 public function get($key)
 {
     $safeKey = $this->makeKey($key);
     $ret = @zend_shm_cache_fetch($safeKey);
     return $ret;
 }
開發者ID:chrismcmacken,項目名稱:phptools,代碼行數:6,代碼來源:Shm.php

示例12: cache_get_data

/**
 * Gets the value from the cache specified by key, so long as it is not older than ttl seconds.
 * - It may often "miss", so shouldn't be depended on.
 * - It supports the same as cache_put_data().
 *
 * @param string $key
 * @param int $ttl = 120
 */
function cache_get_data($key, $ttl = 120)
{
    global $cache_memcached, $memcached, $cache_hits, $cache_count, $db_show_debug;
    global $cache_accelerator, $cache_enable, $expired;
    if (empty($cache_enable)) {
        return;
    }
    $cache_count = isset($cache_count) ? $cache_count + 1 : 1;
    if (isset($db_show_debug) && $db_show_debug === true) {
        $cache_hits[$cache_count] = array('k' => $key, 'd' => 'get');
        $st = microtime(true);
    }
    $key = cache_get_key($key);
    switch ($cache_accelerator) {
        case 'memcached':
            // Okay, let's go for it memcached!
            if ((function_exists('memcache_get') || function_exists('memcached_get')) && !empty($cache_memcached)) {
                // Not connected yet?
                if (empty($memcached)) {
                    get_memcached_server();
                }
                if (!$memcached) {
                    return null;
                }
                $value = function_exists('memcache_get') ? memcache_get($memcached, $key) : memcached_get($memcached, $key);
            }
            break;
        case 'eaccelerator':
            // Again, eAccelerator.
            if (function_exists('eaccelerator_get')) {
                $value = eaccelerator_get($key);
            }
            break;
        case 'mmcache':
            // The older, but ever-stable, Turck MMCache...
            if (function_exists('mmcache_get')) {
                $value = mmcache_get($key);
            }
            break;
        case 'apc':
        case 'apcu':
            // This is the free APC or APCu from PECL.
            if (function_exists('apc_fetch')) {
                $value = apc_fetch($key . 'elkarte');
            }
            break;
        case 'zend':
            // Zend's pricey stuff.
            if (function_exists('zend_shm_cache_fetch')) {
                $value = zend_shm_cache_fetch('ELK::' . $key);
            } elseif (function_exists('output_cache_get')) {
                $value = output_cache_get($key, $ttl);
            }
            break;
        case 'xcache':
            if (function_exists('xcache_get') && ini_get('xcache.var_size') > 0) {
                $value = xcache_get($key);
            }
            break;
        default:
            // Otherwise it's ElkArte data!
            if (file_exists(CACHEDIR . '/data_' . $key . '.php') && filesize(CACHEDIR . '/data_' . $key . '.php') > 10) {
                // php will cache file_exists et all, we can't 100% depend on its results so proceed with caution
                @(include CACHEDIR . '/data_' . $key . '.php');
                if (!empty($expired) && isset($value)) {
                    @unlink(CACHEDIR . '/data_' . $key . '.php');
                    unset($value);
                }
            }
            break;
    }
    if (isset($db_show_debug) && $db_show_debug === true) {
        $cache_hits[$cache_count]['t'] = microtime(true) - $st;
        $cache_hits[$cache_count]['s'] = isset($value) ? strlen($value) : 0;
    }
    if (function_exists('call_integration_hook') && isset($value)) {
        call_integration_hook('cache_get_data', array($key, $ttl, $value));
    }
    return empty($value) ? null : @unserialize($value);
}
開發者ID:KeiroD,項目名稱:Elkarte,代碼行數:88,代碼來源:Cache.subs.php

示例13: doContains

 /**
  * {@inheritdoc}
  */
 protected function doContains($id)
 {
     return false !== zend_shm_cache_fetch($id);
 }
開發者ID:BusinessCookies,項目名稱:CoffeeMachineProject,代碼行數:7,代碼來源:ZendDataCache.php

示例14: get

 /**
  * {@inheritdoc}
  */
 public function get($key)
 {
     return zend_shm_cache_fetch($key);
 }
開發者ID:muhammetardayildiz,項目名稱:framework,代碼行數:7,代碼來源:ZendMemory.php

示例15: addValue

 /**
  * Stores a value identified by a key into cache if the cache does not contain this key.
  * This is the implementation of the method declared in the parent class.
  *
  * @param string $key the key identifying the value to be cached
  * @param string $value the value to be cached
  * @param integer $duration the number of seconds in which the cached value will expire. 0 means never expire.
  * @return boolean true if the value is successfully stored into cache, false otherwise
  */
 protected function addValue($key, $value, $duration)
 {
     return zend_shm_cache_fetch($key) === null ? $this->setValue($key, $value, $duration) : false;
 }
開發者ID:smallmirror62,項目名稱:framework,代碼行數:13,代碼來源:ZendDataCache.php


注:本文中的zend_shm_cache_fetch函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。