当前位置: 首页>>代码示例>>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;未经允许,请勿转载。