/** * Retrieve an item from the cache by key. * * @param string $key * @return mixed */ public function get($key) { $value = wincache_ucache_get($this->getPrefixWithLocale() . $key); if ($value !== false) { return $value; } }
/** * 写入缓存 * @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; }
/** * @see SugarCacheAbstract::_getExternal() */ protected function _getExternal($key) { if (!wincache_ucache_exists($key)) { return null; } return wincache_ucache_get($key); }
/** * Get * * Look for a value in the cache. If it exists, return the data, * if not, return FALSE * * @param string $id Cache Ide * @return mixed Value that is stored/FALSE on failure */ public function get($id) { $success = FALSE; $data = wincache_ucache_get($id, $success); // Success returned by reference from wincache_ucache_get() return $success ? $data : FALSE; }
/** * Retrieve an item from the cache by key. * * @param string $key * @return mixed */ protected function retrieveItem($key) { $value = wincache_ucache_get($this->prefix . $key); if ($value !== false) { return $value; } }
/** * Retrieve an item from the cache by key. * * @param string $key * @return mixed */ public function get($key) { $value = wincache_ucache_get($this->prefix . $key); if ($value !== false) { return $value; } }
/** * Fetch a cache record from this cache driver instance * * @param string $id cache id * @param boolean $testCacheValidity if set to false, the cache validity won't be tested * @return mixed Returns either the cached data or false */ protected function _doFetch($id, $testCacheValidity = true) { $cache = wincache_ucache_get($id, $success); if ($success === false) { return false; } return $cache; }
public function get($key) { if (wincache_ucache_exists($this->type . '_' . $key)) { $data = wincache_ucache_get($this->type . '_' . $key); return $data; } return false; }
/** * 获取一个已经缓存的变量 * * @access public * * @param string $key 缓存Key * * @return mixed */ public function get($key) { //参数分析 if ($key) { return false; } return wincache_ucache_get($key); }
/** * Retrieve a cached value entry by id. * * // Retrieve cache entry from wincache group * $data = Cache::instance('wincache')->get('foo'); * * // Retrieve cache entry from wincache group and return 'bar' if miss * $data = Cache::instance('wincache')->get('foo', 'bar'); * * @param string id of cache to entry * @param string default value to return if cache miss * @return mixed * @throws Cache_Exception */ public function get($id, $default = NULL) { // for ProfilerToolbar ProfilerToolbar::cacheLog('get', array_search($this, Cache::$instances), $id); // /for ProfilerToolbar $data = wincache_ucache_get($this->_sanitize_id($id), $success); return $success ? $data : $default; }
function cs_cache_load($name, $ttl = 0) { $token = empty($ttl) ? $name : 'ttl_' . $name; if (wincache_ucache_exists($token)) { return wincache_ucache_get($token); } return false; }
/** * {@inheritdoc} */ public function get($key) { $value = wincache_ucache_get($this->key($key), $success); if (!$success) { return null; } return $value; }
/** * Fetches an item from the cache if it is still valid * * @param string $key * @return mixed */ public function get($key) { $value = wincache_ucache_get($key, $success); if ($success) { return $value; } return false; }
/** * @param string $key * @return mixed */ public function get($key) { $value = wincache_ucache_get($key, $sucess); if ($sucess == false) { return null; } return $value; }
/** * Get a value from the WinCache object cache * * @param $key String: cache key * @return mixed */ public function get($key) { $val = wincache_ucache_get($key); if (is_string($val)) { $val = unserialize($val); } return $val; }
protected function getWithToken($key, &$casToken, $flags = 0) { $val = wincache_ucache_get($key); $casToken = $val; if (is_string($val)) { $val = unserialize($val); } return $val; }
protected function _get($key) { $success = false; $data = wincache_ucache_get($key, $success); if ($success === false) { return self::NOT_FOUND; } return $data; }
/** * Read a key from the cache * * @param string $key Identifier for the data * @return mixed The cached data, or false if the data doesn't exist, has expired, or if * there was an error fetching it */ public function read($key) { $time = time(); $cachetime = intval(wincache_ucache_get($key . '_expires')); if ($cachetime < $time || $time + $this->settings['duration'] < $cachetime) { return false; } return wincache_ucache_get($key); }
/** * @param \Psr\Cache\CacheItemInterface $item * @return mixed */ protected function driverRead(CacheItemInterface $item) { $val = wincache_ucache_get($item->getKey(), $suc); if ($suc === false) { return null; } else { return $val; } }
/** * {@inheritdoc} */ public function get($key) { $cache = wincache_ucache_get($key, $success); if ($success === true) { return $cache; } else { return false; } }
/** * Get a value from the WinCache object cache * * @param string $key Cache key * @param int $casToken [optional] Cas token * @return mixed */ public function get($key, &$casToken = null) { $val = wincache_ucache_get($key); $casToken = $val; if (is_string($val)) { $val = unserialize($val); } return $val; }
public function select($key) { $success = false; if (function_exists('wincache_ucache_get')) { $data = wincache_ucache_get($key, $success); } else { return getMessage('Cache', 'unsupported', 'Wincache'); } return $success ? $data : false; }
/** * Method to get a storage entry value from a key. * * @param string $key The storage entry identifier. * * @return CacheItemInterface * * @since 1.0 */ public function get($key) { $item = new Item($key); $success = true; $value = wincache_ucache_get($key, $success); if ($success) { $item->setValue($value); } return $item; }
/** * {@inheritdoc} * * @param string $keyName * @param integer $lifetime * @return mixed|null */ public function get($keyName, $lifetime = null) { $value = wincache_ucache_get($keyName, $success); if ($success === false) { return null; } $frontend = $this->getFrontend(); $this->setLastKey($keyName); return $frontend->afterRetrieve($value); }
/** * {@inheritdoc} * * @param string $keyName * @param integer $lifetime * @return mixed|null */ public function get($keyName, $lifetime = null) { $prefixedKey = $this->getPrefixedIdentifier($keyName); $cachedContent = wincache_ucache_get($prefixedKey, $success); $this->_lastKey = $prefixedKey; if ($success === false) { return null; } return $this->_frontend->afterRetrieve($cachedContent); }
public function fetchMultiple(array $keys) { $values = wincache_ucache_get($keys); foreach ($keys as $key) { if (!array_key_exists($key, $values)) { $values[$key] = false; } } return $values; }
public function gc() { $allinfo = wincache_ucache_info(); $keys = $allinfo['cache_entries']; $secret = $this->_hash; foreach ($keys as $key) { if (strpos($key['key_name'], $secret . '-cache-')) { wincache_ucache_get($key['key_name']); } } }
/** * Fetches the data from shared memory and detects errors * * @param string title of the datastore item * @param array A reference to an array of items that failed and need to fetched from the database * * @return boolean */ protected function do_fetch($title, &$unfetched_items) { $ptitle = $this->prefix . $title; if (($data = wincache_ucache_get($ptitle)) === false) { // appears its not there, lets grab the data, lock the shared memory and put it in $unfetched_items[] = $title; return false; } $this->register($title, $data); return true; }
function get($key) { $value = parent::get($key); if (!is_null($value)) { return $value; } if (EXTERNAL_CACHE_DEBUG) { SugarCache::log('grabbing via wincache_ucache_get(' . $this->_realKey($key) . ')'); } return $this->_processGet($key, wincache_ucache_get($this->_realKey($key))); }
function driver_get($keyword, $option = array()) { // return null if no caching // return value if in caching $x = wincache_ucache_get($keyword, $suc); if ($suc == false) { return null; } else { return $x; } }