本文整理汇总了PHP中xcache_get函数的典型用法代码示例。如果您正苦于以下问题:PHP xcache_get函数的具体用法?PHP xcache_get怎么用?PHP xcache_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xcache_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Retrieve an item from the cache by key.
*
* @param string $key
* @return mixed
*/
public function get($key)
{
$value = xcache_get($this->getPrefixWithLocale() . $key);
if (isset($value)) {
return $value;
}
}
示例2: get
public function get($key)
{
if (!$key) {
return false;
}
return xcache_isset($key) ? xcache_get($key) : false;
}
示例3: get
/**
* 读取缓存,失败或缓存撒失效时返回 false
*
* @param string $id
*
* @return mixed
*/
function get($id)
{
if (xcache_isset($id)) {
return xcache_get($id);
}
return false;
}
示例4: get
/**
* Gets a value from the variable store
* @param string $key The key of the variable
* @param mixed $default The default value for when the key is not set
* @return mixed The value of the variable if it exists, the provided default value otherwise
*/
public function get($key, $default = null)
{
if (xcache_isset($key)) {
return xcache_get($key);
}
return $default;
}
示例5: realGet
/**
* Get cache record implementation
* @param string $id
* @param boolean $doNotTestCacheValidity
* @return string
*/
public function realGet($id, $doNotTestCacheValidity = false)
{
if (xcache_isset($id)) {
return xcache_get($id);
}
return null;
}
示例6: get
public static function get($key)
{
global $config, $debug;
$key = $config['cache']['prefix'] . $key;
$data = false;
switch ($config['cache']['enabled']) {
case 'memcached':
if (!self::$cache) {
self::init();
}
$data = self::$cache->get($key);
break;
case 'apc':
$data = apc_fetch($key);
break;
case 'xcache':
$data = xcache_get($key);
break;
case 'php':
$data = isset(self::$cache[$key]) ? self::$cache[$key] : false;
break;
case 'redis':
if (!self::$cache) {
self::init();
}
$data = json_decode(self::$cache->get($key), true);
break;
}
if ($config['debug']) {
$debug['cached'][] = $key . ($data === false ? ' (miss)' : ' (hit)');
}
return $data;
}
示例7: cacheget
function cacheget($name)
{
if (!$this->cache_type) {
return;
}
$rdata2 = false;
if (!$this->thestorage) {
switch ($this->cache_type) {
case 1:
if ($this->connect()) {
$rdata = $this->mchandle->get(VBSEO_CACHE_VAR);
}
break;
case 2:
$rdata = apc_fetch(VBSEO_CACHE_VAR);
break;
case 3:
if (xcache_isset(VBSEO_CACHE_VAR)) {
$rdata = xcache_get(VBSEO_CACHE_VAR);
}
break;
case 4:
$rdata = eaccelerator_get(VBSEO_CACHE_VAR);
break;
}
if ($rdata) {
$this->thestorage = unserialize($rdata);
} else {
$this->thestorage = array();
}
}
$rdata2 = $this->thestorage[$name];
return $rdata2;
}
示例8: readCache
/**
* Get
*
* Since this is the dummy class, it's always going to return FALSE.
*
* @param string
* @return Boolean FALSE
*/
public function readCache($type, $name, $ID, $onlyCheck = FALSE)
{
$this->getInstance();
$originalID = $ID;
if (isset($_POST) && count($_POST) > 0) {
$ID = $ID . md5(serialize($_POST));
}
self::logMessage('cache', "Cche xcache reading {$type} - {$name} - {$ID}.");
$item_expiration = $this->getCacheItemExpiration($type, $name, $originalID);
if (is_array($item_expiration)) {
$item_properties = $item_expiration;
$name .= '-' . $item_properties[0];
$item_expiration = $item_properties[1];
}
if ($item_expiration == FALSE) {
$item_expiration = $this->getCacheConfigItem('default', $type);
if ($item_expiration == FALSE) {
return FALSE;
}
}
$cache = xcache_get($type . '-' . $name . '-' . $ID);
if ($cache == FALSE) {
return FALSE;
}
self::logMessage('cache', 'Cache xcache read OK: ' . $type . '/' . $name . '/' . $ID);
if ($cache && $onlyCheck) {
return TRUE;
}
return unserialize($cache);
}
示例9: expired
/**
* {@inheritdoc}
*/
public function expired($key, $mins)
{
$key = $this->getName($key);
if (xcache_isset($key)) {
return time() - xcache_get($key)['created'] > $mins * 60;
}
}
示例10: set
/**
* 写入缓存
* @access public
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param integer $expire 有效时间(秒)
* @return boolean
*/
public function set($name, $value, $expire = null)
{
if (is_null($expire)) {
$expire = $this->options['expire'];
}
$name = $this->options['prefix'] . $name;
if (xcache_set($name, $value, $expire)) {
if ($this->options['length'] > 0) {
// 记录缓存队列
$queue = xcache_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);
// 删除缓存
xcache_unset($key);
}
xcache_set('__info__', $queue);
}
return true;
}
return false;
}
示例11: get
public function get($key)
{
if (xcache_isset($key)) {
return xcache_get($key);
}
return FALSE;
}
示例12: get
public function get($id)
{
if (xcache_isset($id)) {
return xcache_get($id);
}
return NULL;
}
示例13: get
/**
* Returns cached value by key or false if there is no cache entry for the given key
*
* @param string $key
* @return bool|mixed
*/
public function get($key)
{
if ($value = xcache_get($this->prepareKey($key))) {
return $this->unserializeCompound($value);
}
return false;
}
示例14: __get
public function __get($index)
{
if (function_exists('xcache_get')) {
return xcache_get($index);
}
return null;
}
示例15: get
function get($key)
{
if (!ini_get('xcache.var_size')) {
return FALSE;
}
return unserialize(strval(@xcache_get($key)));
}