• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP zend_shm_cache_fetch函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中zend_shm_cache_fetch函数的典型用法代码示例。如果您正苦于以下问题:PHP zend_shm_cache_fetch函数的具体用法?PHP zend_shm_cache_fetch怎么用?PHP zend_shm_cache_fetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了zend_shm_cache_fetch函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: 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
 * @return string
 */
function cache_get_data($key, $ttl = 120)
{
    global $boardurl, $sourcedir, $modSettings, $memcached;
    global $cache_hits, $cache_count, $db_show_debug, $cachedir;
    global $cache_accelerator, $cache_enable;
    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();
    }
    $key = md5($boardurl . filemtime($sourcedir . '/Load.php')) . '-SMF-' . strtr($key, ':/', '-_');
    switch ($cache_accelerator) {
        case 'memcache':
            // Okay, let's go for it memcached!
            if ((function_exists('memcache_get') || function_exists('memcached_get')) && isset($modSettings['cache_memcached']) && trim($modSettings['cache_memcached']) != '') {
                // Not connected yet?
                if (empty($memcached)) {
                    get_memcached_server();
                }
                if (!$memcached) {
                    return null;
                }
                $value = function_exists('memcache_get') ? memcache_get($cache['connection'], $key) : memcached_get($cache['connection'], $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':
            // This is the free APC from PECL.
            if (function_exists('apc_fetch')) {
                $value = apc_fetch($key . 'smf');
            }
            break;
        case 'zend':
            // Zend's pricey stuff.
            if (function_exists('zend_shm_cache_fetch')) {
                $value = zend_shm_cache_fetch('SMF::' . $key, $ttl);
            } 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 SMF 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'] = array_sum(explode(' ', microtime())) - array_sum(explode(' ', $st));
        $cache_hits[$cache_count]['s'] = isset($value) ? strlen($value) : 0;
    }
    if (function_exists('call_integration_hook')) {
        call_integration_hook('cache_get_data', array(&$key, &$ttl, &$value));
    }
    return empty($value) ? null : @unserialize($value);
}
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:89,代码来源:Load.php


示例17: 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 $expire 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, $expire)
 {
     return NULL === zend_shm_cache_fetch($key) ? $this->setValue($key, $value, $expire) : false;
 }
开发者ID:IuriiP,项目名称:yii-tracker,代码行数:13,代码来源:CZendDataCache.php


示例18: read

 /**
  * Read datas with $uid key
  * @param mixed $uid
  * @return mixed
  */
 public function read($uid)
 {
     return zend_shm_cache_fetch($uid);
 }
开发者ID:cityware,项目名称:city-shared-memory,代码行数:9,代码来源:ZendShmCache.php


示例19: Aspis_create_function

function Aspis_create_function($params, $code)
{
    global $ASPIS_PIPE_SEND;
    global $ASPIS_PIPE_RECEIVE;
    global $ASPIS_CATEGORIES_FILE;
    //is it there in the cache?
    if (isset($_SERVER[0]['HTTP_USER_AGENT'])) {
        $dynamic_functions = zend_shm_cache_fetch('wp_dynamic_functions');
        if ($dynamic_functions !== false) {
            if (isset($dynamic_functions[$code[0]]) && !empty($dynamic_functions[$code[0]])) {
                //                echo "Dynamic function <br>$code[0]<br> is in cache!<br>";
                return create_function($params[0], $dynamic_functions[$code[0]]);
            }
        }
    }
    $r = posix_mkfifo($ASPIS_PIPE_SEND, 0777);
    if (!$r) {
        unlink($ASPIS_PIPE_SEND);
        $r = posix_mkfifo($ASPIS_PIPE_SEND, 0777);
        if (!$r) {
            die("Could not create pipe {$ASPIS_PIPE_SEND}\n");
        }
    }
    $r = posix_mkfifo($ASPIS_PIPE_RECEIVE, 0777);
    if (!$r) {
        unlink($ASPIS_PIPE_RECEIVE);
        $r = posix_mkfifo($ASPIS_PIPE_RECEIVE, 0777);
        if (!$r) {
            die("Could not create pipe {$ASPIS_PIPE_RECEIVE}\n");
        }
    }
    if (!$r) {
        die("Could not create pipe {$ASPIS_PIPE}\n");
    }
    exec("aspis -in {$ASPIS_PIPE_SEND} -out {$ASPIS_PIPE_RECEIVE} -categories {$ASPIS_CATEGORIES_FILE} -mode online >/dev/null &", $a);
    $handle_send = fopen($ASPIS_PIPE_SEND, 'w');
    fwrite($handle_send, "<?php " . $code[0]);
    fclose($handle_send);
    $a = file($ASPIS_PIPE_RECEIVE);
    array_shift($a);
    unlink($ASPIS_PIPE_SEND);
    unlink($ASPIS_PIPE_RECEIVE);
    $rewritten = implode($a);
    //store it to the cache
    if (isset($_SERVER[0]['HTTP_USER_AGENT'])) {
        $dynamic_functions = zend_shm_cache_fetch('wp_dynamic_functions');
        //        echo "Storing rewritten version: $rewritten<br>";
        if ($dynamic_functions !== false) {
            $dynamic_functions[$code[0]] = $rewritten;
            zend_shm_cache_store('wp_dynamic_functions', $dynamic_functions, 24 * 3600);
        } else {
            $dynamic_functions = array($code[0] => $rewritten);
            zend_shm_cache_store('wp_dynamic_functions', $dynamic_functions, 24 * 3600);
        }
    }
    return array(create_function($params[0], $rewritten), false);
}
开发者ID:NetPainter,项目名称:aspis,代码行数:57,代码来源:AspisLibrary.php


示例20: getValue

 protected function getValue($key)
 {
     return zend_shm_cache_fetch($key);
 }
开发者ID:jellycheng,项目名称:windframework,代码行数:4,代码来源:WindZendCache.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP zend_shm_cache_store函数代码示例发布时间:2022-05-23
下一篇:
PHP zend_shm_cache_delete函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap