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


PHP zend_shm_cache_store函数代码示例

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


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

示例1: zdcStore

 /**
  * Store data into Zend Data SHM Cache
  *
  * @param  string $internalKey
  * @param  mixed  $value
  * @param  int    $ttl
  * @return void
  * @throws Exception\RuntimeException
  */
 protected function zdcStore($internalKey, $value, $ttl)
 {
     if (!zend_shm_cache_store($internalKey, $value, $ttl)) {
         $valueType = gettype($value);
         throw new Exception\RuntimeException("zend_disk_cache_store({$internalKey}, <{$valueType}>, {$ttl}) failed");
     }
 }
开发者ID:Baft,项目名称:Zend-Form,代码行数:16,代码来源:ZendServerShm.php

示例2: _store

 /**
  * Store data
  *
  * @param mixed  $data        Object to store
  * @param string $id          Cache id
  * @param int    $timeToLive  Time to live in seconds
  *
  */
 protected function _store($data, $id, $timeToLive)
 {
     if (zend_shm_cache_store($this->_options['namespace'] . '::' . $id, $data, $timeToLive) === false) {
         $this->_log('Store operation failed.');
         return false;
     }
     return true;
 }
开发者ID:Gradven,项目名称:what3.1.7,代码行数:16,代码来源:ShMem.php

示例3: driverWrite

 /**
  * @param \Psr\Cache\CacheItemInterface $item
  * @return mixed
  * @throws \InvalidArgumentException
  */
 protected function driverWrite(CacheItemInterface $item)
 {
     /**
      * Check for Cross-Driver type confusion
      */
     if ($item instanceof Item) {
         $ttl = $item->getExpirationDate()->getTimestamp() - time();
         return zend_shm_cache_store($item->getKey(), $this->driverPreWrap($item), $ttl > 0 ? $ttl : 0);
     } else {
         throw new \InvalidArgumentException('Cross-Driver type confusion detected');
     }
 }
开发者ID:jigoshop,项目名称:Jigoshop2,代码行数:17,代码来源:Driver.php

示例4: 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

示例5: set

 function set($key, $value)
 {
     parent::set($key, $value);
     // caching is turned off
     if (!$GLOBALS['external_cache_enabled']) {
         return;
     }
     $external_key = $this->_realKey($key);
     if (EXTERNAL_CACHE_DEBUG) {
         SugarCache::log("Step 3: Converting key ({$key}) to external key ({$external_key})");
     }
     zend_shm_cache_store($external_key, serialize($value), $this->timeout);
     if (EXTERNAL_CACHE_DEBUG) {
         SugarCache::log("Step 4: Added key to Zend cache {$external_key} with value ({$value}) to be stored for " . EXTERNAL_CACHE_INTERVAL_SECONDS . " seconds");
     }
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:16,代码来源:SugarCache_ZendServer.php

示例6: _setExternal

 /**
  * @see SugarCacheAbstract::_setExternal()
  */
 protected function _setExternal($key, $value)
 {
     zend_shm_cache_store($key, serialize($value), $this->_expireTimeout);
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:7,代码来源:SugarCacheZend.php

示例7: add

 /**
  * Add to the cache
  *
  * Add a new variable to the cache that you will then be able
  * to retrieve using the $this->get($name) method.
  *
  * @param  string  $name   The name of the cache variable to store.
  * @param  string  $value  The value of the cache variable to store.
  * @param  integer $expire When should it expire? Default: 900 seconds.
  * 
  * @return boolean       Depending on the success of the operation, 
  *                       either true or false. 
  */
 public function add($name, $value, $expiry = 900)
 {
     return zend_shm_cache_store($name, $value, $expiry);
 }
开发者ID:crlang44,项目名称:frapi,代码行数:17,代码来源:Zendshm.php

示例8: set

 public function set($key, $value, $ttl = 0)
 {
     $safeKey = $this->makeKey($key);
     $ret = @zend_shm_cache_store($safeKey, $value, $ttl);
     return $ret;
 }
开发者ID:chrismcmacken,项目名称:phptools,代码行数:6,代码来源:Shm.php

示例9: set

 /**
  * Veri ataması yapar
  *
  * @param string $name
  * @param mixed $value
  * @param int $time
  * @return mixed
  */
 public function set($name, $value, $time = 3600)
 {
     return zend_shm_cache_store($name, $value, $time);
 }
开发者ID:AnonymPHP,项目名称:Anonym-Cache,代码行数:12,代码来源:ZendDataCache.php

示例10: cache_put_data

/**
 * Puts value in the cache under key for ttl seconds.
 *
 * - It may "miss" so shouldn't be depended on
 * - Uses the cache engine chosen in the ACP and saved in settings.php
 * - It supports:
 *     Turck MMCache: http://turck-mmcache.sourceforge.net/index_old.html#api
 *     Xcache: http://xcache.lighttpd.net/wiki/XcacheApi
 *     memcache: http://www.php.net/memcache
 *     APC: http://www.php.net/apc
 *     eAccelerator: http://bart.eaccelerator.net/doc/phpdoc/
 *     Zend: http://files.zend.com/help/Zend-Platform/output_cache_functions.htm
 *     Zend: http://files.zend.com/help/Zend-Platform/zend_cache_functions.htm
 *
 * @param string $key
 * @param string|int|mixed[]|null $value
 * @param int $ttl = 120
 */
function cache_put_data($key, $value, $ttl = 120)
{
    global $cache_memcached, $memcached, $cache_hits, $cache_count, $db_show_debug;
    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' => 'put', 's' => $value === null ? 0 : strlen(serialize($value)));
        $st = microtime(true);
    }
    $key = cache_get_key($key);
    $value = $value === null ? null : serialize($value);
    switch ($cache_accelerator) {
        case 'memcached':
            // The simple yet efficient memcached.
            if (function_exists('memcached_set') || function_exists('memcache_set') && !empty($cache_memcached)) {
                // Not connected yet?
                if (empty($memcached)) {
                    get_memcached_server();
                }
                if (!$memcached) {
                    return;
                }
                memcache_set($memcached, $key, $value, 0, $ttl);
            }
            break;
        case 'eaccelerator':
            // eAccelerator...
            if (function_exists('eaccelerator_put')) {
                if (mt_rand(0, 10) == 1) {
                    eaccelerator_gc();
                }
                if ($value === null) {
                    @eaccelerator_rm($key);
                } else {
                    eaccelerator_put($key, $value, $ttl);
                }
            }
            break;
        case 'mmcache':
            // Turck MMCache?
            if (function_exists('mmcache_put')) {
                if (mt_rand(0, 10) == 1) {
                    mmcache_gc();
                }
                if ($value === null) {
                    @mmcache_rm($key);
                } else {
                    mmcache_lock($key);
                    mmcache_put($key, $value, $ttl);
                    mmcache_unlock($key);
                }
            }
            break;
        case 'apc':
        case 'apcu':
            // Alternative PHP Cache, ahoy!
            if (function_exists('apc_store')) {
                // An extended key is needed to counteract a bug in APC.
                if ($value === null) {
                    apc_delete($key . 'elkarte');
                } else {
                    apc_store($key . 'elkarte', $value, $ttl);
                }
            }
            break;
        case 'zend':
            // Zend Platform/ZPS/etc.
            if (function_exists('zend_shm_cache_store')) {
                zend_shm_cache_store('ELK::' . $key, $value, $ttl);
            } elseif (function_exists('output_cache_put')) {
                output_cache_put($key, $value);
            }
            break;
        case 'xcache':
            if (function_exists('xcache_set') && ini_get('xcache.var_size') > 0) {
                if ($value === null) {
                    xcache_unset($key);
                } else {
                    xcache_set($key, $value, $ttl);
//.........这里部分代码省略.........
开发者ID:KeiroD,项目名称:Elkarte,代码行数:101,代码来源:Cache.subs.php

示例11: doSave

 /**
  * {@inheritdoc}
  */
 protected function doSave($id, $data, $lifeTime = 0)
 {
     return zend_shm_cache_store($id, $data, $lifeTime);
 }
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:7,代码来源:ZendDataCache.php

示例12: pmxCachePut

 function pmxCachePut($key, $value, $ttl, $useMember = false, $cleaner = null)
 {
     global $PortaMx_cache, $user_info;
     $st = microtime(true);
     if ($value === null && $cleaner !== null && $useMember) {
         $ckey = $PortaMx_cache['key'] . '-' . $cleaner . '-' . $key;
     } else {
         $ckey = $PortaMx_cache['key'] . ($useMember ? '-' . implode('_', $user_info['groups']) : '') . '-' . $key;
     }
     if (function_exists('zend_shm_cache_store')) {
         zend_shm_cache_store('PMX::' . $ckey, $value, $ttl);
     } elseif (function_exists('output_cache_put')) {
         output_cache_put($ckey, $value);
     }
     if ($value !== null) {
         $PortaMx_cache['vals']['saved'] += strlen($value);
     }
     $PortaMx_cache['vals']['time'] += microtime(true) - $st;
     // handle member groups key?
     if ($useMember && $cleaner === null) {
         pmxCacheMemGroupAcs();
     }
 }
开发者ID:thunderamur,项目名称:PortaMx-Virgo-2.0-Beta-2,代码行数:23,代码来源:SubsCache.php

示例13: setValue

 /**
  * Stores a value identified by a key in cache.
  * 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 setValue($key, $value, $duration)
 {
     return zend_shm_cache_store($key, $value, $duration);
 }
开发者ID:smallmirror62,项目名称:framework,代码行数:13,代码来源:ZendDataCache.php

示例14: store

 public function store($key, array $document)
 {
     zend_shm_cache_store("MongoObject::{$key}", $document);
 }
开发者ID:dintel,项目名称:mongo-object,代码行数:4,代码来源:ZendDataCacheShm.php

示例15: load_taint_categories

function load_taint_categories()
{
    global $taint_categories;
    $read_file = true;
    if (isset($_SERVER[0]['HTTP_USER_AGENT'])) {
        $taint_categories = zend_shm_cache_fetch('taint_categories');
        if ($taint_categories !== false) {
            $read_file = false;
        }
    }
    if ($read_file) {
        global $ASPIS_CATEGORIES_FILE;
        $file = file($ASPIS_CATEGORIES_FILE, FILE_USE_INCLUDE_PATH | FILE_IGNORE_NEW_LINES);
        for ($i = 0; $i < count($file); $i++) {
            $line = $file[$i];
            if ($line == "begin") {
                $tc = array(array(), array());
                $reading_sanitisation = 0;
                $reading_sinks = 0;
                $reading_sources = 0;
                while (1) {
                    $line = $file[++$i];
                    if ($line == "end") {
                        break;
                    } else {
                        if ($line == ">sanitisation") {
                            $reading_sanitisation = 1;
                            continue;
                        } else {
                            if ($line == ">sinks") {
                                $reading_sanitisation = 0;
                                $reading_sinks = 1;
                                continue;
                            } else {
                                if ($line == ">sources") {
                                    $reading_sanitisation = 0;
                                    $reading_sinks = 0;
                                    $reading_sources = 1;
                                    continue;
                                }
                            }
                        }
                    }
                    if ($reading_sanitisation) {
                        $tc[0][$line] = 1;
                    } else {
                        if ($reading_sinks || $reading_sources) {
                            $tok1 = strtok($line, "->");
                            $tok2 = strtok("->");
                            if ($tok1 != "" && $tok2 != "") {
                                if ($reading_sinks) {
                                    $tc[1][$tok1] = $tok2;
                                } else {
                                    if ($reading_sources) {
                                        $tc[2][$tok1] = $tok2;
                                    }
                                }
                            } else {
                                die("Invalid guard in the category file");
                            }
                        }
                    }
                }
                $taint_categories[] = $tc;
            }
        }
        if (isset($_SERVER[0]['HTTP_USER_AGENT'])) {
            zend_shm_cache_store('taint_categories', $taint_categories, 24 * 3600);
        }
    }
}
开发者ID:NetPainter,项目名称:aspis,代码行数:71,代码来源:AspisMain.php


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