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


PHP wincache_ucache_set函数代码示例

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


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

示例1: set

 /**
  * {@inheritdoc}
  */
 public function set($key, $value, $ttl = null)
 {
     if (!$ttl) {
         $ttl = $this->ttl;
     }
     wincache_ucache_set($key, $value);
 }
开发者ID:janosvajda,项目名称:Cache,代码行数:10,代码来源:WinCache.php

示例2: set

 /**
  *	Store value in cache
  *	@return mixed|FALSE
  *	@param $key string
  *	@param $val mixed
  *	@param $ttl int
  **/
 function set($key, $val, $ttl = 0)
 {
     $fw = Base::instance();
     if (!$this->dsn) {
         return TRUE;
     }
     $ndx = $this->prefix . '.' . $key;
     $time = microtime(TRUE);
     if ($cached = $this->exists($key)) {
         list($time, $ttl) = $cached;
     }
     $data = $fw->serialize(array($val, $time, $ttl));
     $parts = explode('=', $this->dsn, 2);
     switch ($parts[0]) {
         case 'apc':
         case 'apcu':
             return apc_store($ndx, $data, $ttl);
         case 'redis':
             return $this->ref->set($ndx, $data, array('ex' => $ttl));
         case 'memcache':
             return memcache_set($this->ref, $ndx, $data, 0, $ttl);
         case 'wincache':
             return wincache_ucache_set($ndx, $data, $ttl);
         case 'xcache':
             return xcache_set($ndx, $data, $ttl);
         case 'folder':
             return $fw->write($parts[1] . $ndx, $data);
     }
     return FALSE;
 }
开发者ID:eghojansu,项目名称:moe,代码行数:37,代码来源:Cache.php

示例3: set

 /**
  * 写入缓存
  * @access public
  * @param string $name 缓存变量名
  * @param mixed $value  存储数据
  * @param integer $expire  有效时间(秒)
  * @return boolean
  */
 public function set($name, $value, $expire = null)
 {
     \think\Cache::$writeTimes++;
     if (is_null($expire)) {
         $expire = $this->options['expire'];
     }
     $name = $this->options['prefix'] . $name;
     if (wincache_ucache_set($name, $value, $expire)) {
         if ($this->options['length'] > 0) {
             // 记录缓存队列
             $queue = wincache_ucache_get('__info__');
             if (!$queue) {
                 $queue = [];
             }
             if (false === array_search($name, $queue)) {
                 array_push($queue, $name);
             }
             if (count($queue) > $this->options['length']) {
                 // 出列
                 $key = array_shift($queue);
                 // 删除缓存
                 wincache_ucache_delete($key);
             }
             wincache_ucache_set('__info__', $queue);
         }
         return true;
     }
     return false;
 }
开发者ID:zhaomingliang,项目名称:think,代码行数:37,代码来源:wincache.php

示例4: save

 /**
  * {@inheritdoc}
  *
  * @param  string                   $keyName
  * @param  string                   $content
  * @param  integer                  $lifetime
  * @param  boolean                  $stopBuffer
  * @throws \Phalcon\Cache\Exception
  */
 public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = true)
 {
     if ($keyName === null) {
         $lastKey = $this->_lastKey;
     } else {
         $lastKey = $keyName;
     }
     if (!$lastKey) {
         throw new Exception('The cache must be started first');
     }
     $frontend = $this->getFrontend();
     if ($content === null) {
         $content = $frontend->getContent();
     }
     //Get the lifetime from the frontend
     if ($lifetime === null) {
         $lifetime = $frontend->getLifetime();
     }
     wincache_ucache_set($lastKey, $frontend->beforeStore($content), $lifetime);
     $isBuffering = $frontend->isBuffering();
     //Stop the buffer, this only applies for Phalcon\Cache\Frontend\Output
     if ($stopBuffer) {
         $frontend->stop();
     }
     //Print the buffer, this only applies for Phalcon\Cache\Frontend\Output
     if ($isBuffering) {
         echo $content;
     }
     $this->_started = false;
 }
开发者ID:shatkovskiy,项目名称:phalcon-sms-factory,代码行数:39,代码来源:Wincache.php

示例5: put

 /**
  * Adds a variable in user cache and overwrites a variable if it already exists in the cache
  *
  * @param string $key 	Store the variable using this $key value.
  *						If a variable with same $key is already present the function will overwrite the previous value with the new one.
  * @param mixed $buff	Value of a variable to store. $value supports all data types except resources, such as file handlers.
  * @param int $valid_time	Time for the variable to live in the cache in seconds.
  *							After the value specified in ttl has passed the stored variable will be deleted from the cache.
  *							If no ttl is supplied, use the default valid time CacheWincache::valid_time.
  * @return bool Returns true on success or false on failure.
  */
 function put($key, $buff, $valid_time = 0)
 {
     if ($valid_time == 0) {
         $valid_time = $this->valid_time;
     }
     return wincache_ucache_set(md5(_XE_PATH_ . $key), array(time(), $buff), $valid_time);
 }
开发者ID:relip,项目名称:xe-core,代码行数:18,代码来源:CacheWincache.class.php

示例6: put

 /**
  * Adds a variable in user cache and overwrites a variable if it already exists in the cache
  *
  * @param string $key 	Store the variable using this $key value.
  * 						If a variable with same $key is already present the function will overwrite the previous value with the new one.
  * @param mixed $buff	Value of a variable to store. $value supports all data types except resources, such as file handlers.
  * @param int $valid_time	Time for the variable to live in the cache in seconds.
  * 							After the value specified in ttl has passed the stored variable will be deleted from the cache.
  * 							If no ttl is supplied, use the default valid time CacheWincache::valid_time.
  * @return bool Returns true on success or false on failure.
  */
 function put($key, $buff, $valid_time = 0)
 {
     if ($valid_time == 0) {
         $valid_time = $this->valid_time;
     }
     return wincache_ucache_set(md5(_XE_PATH_ . $key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time);
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:18,代码来源:CacheWincache.class.php

示例7: set

 /**
  * Store a value in the WinCache object cache
  *
  * @param $key String: cache key
  * @param $value Mixed: object to store
  * @param $expire Int: expiration time
  * @return bool
  */
 public function set($key, $value, $expire = 0)
 {
     $result = wincache_ucache_set($key, serialize($value), $expire);
     /* wincache_ucache_set returns an empty array on success if $value
        was an array, bool otherwise */
     return is_array($result) && $result === array() || $result;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:15,代码来源:WinCacheBagOStuff.php

示例8: set

 /**
  * @param string $key
  * @param mixed $value
  * @param integer $ttl
  * @return mixed
  */
 public function set($key, $value, $ttl = null)
 {
     if (!$this->exists($key)) {
         return wincache_ucache_add($keyword, $value, null === $ttl ? 0 : $ttl);
     }
     return wincache_ucache_set($keyword, $value, null === $ttl ? 0 : $ttl);
 }
开发者ID:mactronique,项目名称:phpcache,代码行数:13,代码来源:WincacheDriver.php

示例9: write

 /**
  * Write data for key into cache
  *
  * @param string $key Identifier for the data
  * @param mixed $value Data to be cached
  * @param integer $duration How long to cache the data, in seconds
  * @return boolean True if the data was successfully cached, false on failure
  */
 public function write($key, $value, $duration)
 {
     $expires = time() + $duration;
     $data = array($key . '_expires' => $expires, $key => $value);
     $result = wincache_ucache_set($data, null, $duration);
     return empty($result);
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:15,代码来源:WincacheEngine.php

示例10: insert

 public function insert($key, $var, $time = 60, $expressed = false)
 {
     if (function_exists('wincache_ucache_set')) {
         return wincache_ucache_set($key, $var, $time);
     } else {
         return getMessage('Cache', 'unsupported', 'Wincache');
     }
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:8,代码来源:WincacheDriver.php

示例11: create

 public function create($key, $value)
 {
     try {
         return wincache_ucache_set($key, $value);
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage(), $ex->getCode());
     }
 }
开发者ID:ZephyrusDev,项目名称:-Hybrid,代码行数:8,代码来源:WinCacheDriver.php

示例12: delete

 /**
  * (Plug-in replacement for memcache API) Delete data from the persistant cache.
  *
  * @param  mixed			Key name
  */
 function delete($key)
 {
     // Update list of e-objects
     global $ECACHE_OBJECTS;
     unset($ECACHE_OBJECTS[$key]);
     wincache_ucache_set(get_file_base() . 'ECACHE_OBJECTS', $ECACHE_OBJECTS, 0);
     wincache_ucache_delete($key);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:13,代码来源:caches_wincache.php

示例13: add

 /**
  * Adds a new item that is to be cached
  *
  * @param string $key
  * @param mixed $data
  * @param bool $overwrite
  * @return bool
  */
 public function add($key, $data, $overwrite = false)
 {
     if ($overwrite == false) {
         return wincache_ucache_add($key, $data, $this->ttl());
     } else {
         return wincache_ucache_set($key, $data, $this->ttl());
     }
 }
开发者ID:jinshana,项目名称:tangocms,代码行数:16,代码来源:Wincache.php

示例14: driver_set

 function driver_set($keyword, $value = "", $time = 300, $option = array())
 {
     if (isset($option['skipExisting']) && $option['skipExisting'] == true) {
         return wincache_ucache_add($keyword, $value, $time);
     } else {
         return wincache_ucache_set($keyword, $value, $time);
     }
 }
开发者ID:rylanb,项目名称:Play-Later,代码行数:8,代码来源:wincache.php

示例15: replace

 public function replace($key, $var, $expire = 0, $options = array())
 {
     $replaced = false;
     if (wincache_ucache_exists($key)) {
         $replaced = wincache_ucache_set($this->getCacheKey($key), $var, $expire);
     }
     return $replaced;
 }
开发者ID:e-gob,项目名称:apps.gob.cl,代码行数:8,代码来源:xpdowincache.class.php


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