Пример #1
0
 /**
  * @see SugarCacheAbstract::_getExternal()
  */
 protected function _getExternal($key)
 {
     if (!wincache_ucache_exists($key)) {
         return null;
     }
     return wincache_ucache_get($key);
 }
Пример #2
0
 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;
 }
Пример #3
0
 function driver_isExisting($keyword)
 {
     if (wincache_ucache_exists($keyword)) {
         return true;
     } else {
         return false;
     }
 }
Пример #4
0
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;
}
Пример #5
0
 public function get($key)
 {
     if (wincache_ucache_exists($this->type . '_' . $key)) {
         $data = wincache_ucache_get($this->type . '_' . $key);
         return $data;
     }
     return false;
 }
Пример #6
0
 /**
  *	Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
  *
  *	@param	string		$pCoord		Coordinate address of the cell to check
  *	@return	void
  *	@return	boolean
  */
 public function isDataSet($pCoord)
 {
     //	Check if the requested entry is the current object, or exists in the cache
     if (parent::isDataSet($pCoord)) {
         if ($this->_currentObjectID == $pCoord) {
             return true;
         }
         //	Check if the requested entry still exists in cache
         $success = wincache_ucache_exists($this->_cachePrefix . $pCoord . '.cache');
         if ($success === false) {
             //	Entry no longer exists in Wincache, so clear it from the cache array
             parent::deleteCacheData($pCoord);
             throw new Exception('Cell entry no longer exists in Wincache');
         }
         return true;
     }
     return false;
 }
Пример #7
0
                    }
                    ?>
        </table>
    </div>
<?php 
                } else {
                    ?>
    <div class="overview">
        <p class="notice">The user cache is not available. Enable the user cache by using <strong>wincache.ucenabled</strong> 
            directive in <strong>php.ini</strong> file.</p>
    </div>
<?php 
                }
            } else {
                if ($page == UCACHE_DATA && $ucache_key != null && USE_AUTHENTICATION) {
                    if (!wincache_ucache_exists($ucache_key)) {
                        ?>
    <div class="overview">
        <p class="notice">The variable with this key does not exist in the user cache.</p>
    </div>
<?php 
                    } else {
                        $ucache_entry_info = wincache_ucache_info(true, $ucache_key);
                        ?>
    <div class="list">
        <table width="60%">
            <tr>
                <th colspan="2">User Cache Entry Information</th>
            </tr>
            <tr>
                <td class="e">Key</td>
Пример #8
0
 /**
  * {@inheritdoc}
  */
 public function has($key)
 {
     return wincache_ucache_exists($key);
 }
Пример #9
0
 /**
  * 读取缓存
  * @access public
  * @param string $name 缓存变量名
  * @return mixed
  */
 public function get($name)
 {
     N('cache_read', 1);
     $name = $this->options['prefix'] . $name;
     return wincache_ucache_exists($name) ? wincache_ucache_get($name) : false;
 }
Пример #10
0
 /**
  * Checks whether a specified key exists in the cache.
  * This can be faster than getting the value from the cache if the data is big.
  * Note that this method does not check whether the dependency associated
  * with the cached data, if there is any, has changed. So a call to [[get]]
  * may return false while exists returns true.
  * @param mixed $key a key identifying the cached value. This can be a simple string or
  * a complex data structure consisting of factors representing the key.
  * @return boolean true if a value exists in cache, false if the value is not in the cache or expired.
  */
 public function exists($key)
 {
     $key = $this->buildKey($key);
     return wincache_ucache_exists($key);
 }
Пример #11
0
 /**
  * {@inheritdoc}
  *
  * @param  string  $keyName
  * @param  string  $lifetime
  * @return boolean
  */
 public function exists($keyName = null, $lifetime = null)
 {
     if ($keyName === null) {
         $lastKey = $this->_lastKey;
     } else {
         $lastKey = $this->getPrefixedIdentifier($keyName);
     }
     return wincache_ucache_exists($lastKey);
 }
Пример #12
0
     self::$objects['memcached']->flush();
     return true;
 }
 private static function memcached_delete($name)
 {
     $name = self::getMemoryName($name);
     return self::$objects['memcached']->delete($name);
 }
 private static function memcached_increment($name, $step = 1)
Пример #13
0
 /**
  * Decrement an item.
  *
  * Options:
  *  - namespace <string> optional
  *    - The namespace to use (Default: namespace of object)
  *  - ignore_missing_items <boolean> optional
  *    - Throw exception on missing item or return false
  *
  * @param  string $key
  * @param  int $value
  * @param  array $options
  * @return int|boolean The new value or false or failure
  * @throws Exception
  *
  * @triggers decrementItem.pre(PreEvent)
  * @triggers decrementItem.post(PostEvent)
  * @triggers decrementItem.exception(ExceptionEvent)
  */
 public function decrementItem($key, $value, array $options = array())
 {
     $baseOptions = $this->getOptions();
     if (!$baseOptions->getWritable()) {
         return false;
     }
     $this->normalizeOptions($options);
     $this->normalizeKey($key);
     $args = new ArrayObject(array('key' => &$key, 'options' => &$options));
     try {
         $eventRs = $this->triggerPre(__FUNCTION__, $args);
         if ($eventRs->stopped()) {
             return $eventRs->last();
         }
         $internalKey = $options['namespace'] . $baseOptions->getNamespaceSeparator() . $key;
         $value = (int) $value;
         $newValue = wincache_ucache_dec($internalKey, $value);
         if ($newValue === false) {
             if (wincache_ucache_exists($internalKey)) {
                 throw new Exception\RuntimeException("wincache_ucache_dec('{$internalKey}', {$value}) failed");
             } elseif (!$options['ignore_missing_items']) {
                 throw new Exception\ItemNotFoundException("Key '{$internalKey}' not found");
             }
             $this->addItem($key, -$value, $options);
             $newValue = -$value;
         }
         return $this->triggerPost(__FUNCTION__, $args, $newValue);
     } catch (\Exception $e) {
         return $this->triggerException(__FUNCTION__, $args, $e);
     }
 }
Пример #14
0
 /**
  * 读取缓存
  * @access public
  * @param string $name 缓存变量名
  * @param mixed  $default 默认值
  * @return mixed
  */
 public function get($name, $default = false)
 {
     $key = $this->getCacheKey($name);
     return wincache_ucache_exists($key) ? wincache_ucache_get($key) : $default;
 }
Пример #15
0
 /**
  * Contains checks if a key exists in the cache
  *
  * @param  string  $key Identifier for the data
  * @return boolean true|false
  */
 public function contains($key)
 {
     return wincache_ucache_exists($key);
 }
Пример #16
0
 /**
  * Check if an item exists in the cache
  *
  * @param   string  $key
  * @return  bool
  */
 public function has($key)
 {
     return wincache_ucache_exists($this->id($key));
 }
Пример #17
0
 /**
  * {@inheritdoc}
  *
  * @param  string  $keyName
  * @param  string  $lifetime
  * @return boolean
  */
 public function exists($keyName = null, $lifetime = null)
 {
     return wincache_ucache_exists($keyName);
 }
Пример #18
0
 /**
  * Internal method to decrement an item.
  *
  * Options:
  *  - ttl <float>
  *    - The time-to-life
  *  - namespace <string>
  *    - The namespace to use
  *  - ignore_missing_items <boolean>
  *    - Throw exception on missing item
  *
  * @param  string $normalizedKey
  * @param  int    $value
  * @param  array  $normalizedOptions
  * @return int|boolean The new value or false on failure
  * @throws Exception
  */
 protected function internalDecrementItem(&$normalizedKey, &$value, array &$normalizedOptions)
 {
     $internalKey = $normalizedOptions['namespace'] . $this->getOptions()->getNamespaceSeparator() . $normalizedKey;
     $value = (int) $value;
     $newValue = wincache_ucache_dec($internalKey, $value);
     if ($newValue === false) {
         if (wincache_ucache_exists($internalKey)) {
             throw new Exception\RuntimeException("wincache_ucache_inc('{$internalKey}', {$value}) failed");
         } elseif (!$normalizedOptions['ignore_missing_items']) {
             throw new Exception\ItemNotFoundException("Key '{$internalKey}' not found");
         }
         $newValue = -$value;
         $this->addItem($normalizedKey, $newValue, $normalizedOptions);
     }
     return $newValue;
 }
Пример #19
0
 /**
  * Checks if a specified key is in the storage.
  * 
  * @param string $key Name of key to check.
  * 
  * @return bool TRUE if the key is in the storage, FALSE otherwise. 
  */
 public function exists($key)
 {
     return wincache_ucache_exists($this->persistentId . $key);
 }
Пример #20
0
 /**
  * Checks if a cache entry with the specified identifier exists
  *
  * @param string $entryIdentifier An identifier specifying the cache entry
  * @return boolean TRUE if such an entry exists, FALSE if not
  */
 public function has($entryIdentifier)
 {
     return wincache_ucache_exists($this->identifierPrefix . $entryIdentifier);
 }
Пример #21
0
 /**
  * 递增
  *
  * 与原始increment方法区别的是若不存指定KEY时返回false,这个会自动递增
  *
  * @param string $key
  * @param int $offset
  * @param int $lifetime 当递减失则时当作set使用
  * @return boolean
  */
 public function increment($key, $offset = 1, $lifetime = 60)
 {
     if (wincache_ucache_inc($this->prefix . $key, $offset)) {
         return true;
     } elseif (false == wincache_ucache_exists($this->prefix . $key) && $this->set($key, $offset, $lifetime)) {
         return true;
     } else {
         return false;
     }
 }
Пример #22
0
 /**
  * Internal method to replace an existing item.
  *
  * @param  string $normalizedKey
  * @param  mixed  $value
  * @return bool
  * @throws Exception\ExceptionInterface
  */
 protected function internalReplaceItem(&$normalizedKey, &$value)
 {
     $options = $this->getOptions();
     $namespace = $options->getNamespace();
     $prefix = $namespace === '' ? '' : $namespace . $options->getNamespaceSeparator();
     $internalKey = $prefix . $normalizedKey;
     if (!wincache_ucache_exists($internalKey)) {
         return false;
     }
     $ttl = $options->getTtl();
     if (!wincache_ucache_set($internalKey, $value, $ttl)) {
         $type = is_object($value) ? get_class($value) : gettype($value);
         throw new Exception\RuntimeException("wincache_ucache_set('{$internalKey}', <{$type}>, {$ttl}) failed");
     }
     return true;
 }
Пример #23
0
 /**
  * 读取缓存
  * @access public
  * @param string $name 缓存变量名
  * @return mixed
  */
 public function get($name)
 {
     \think\Cache::$readTimes++;
     $name = $this->options['prefix'] . $name;
     return wincache_ucache_exists($name) ? wincache_ucache_get($name) : false;
 }
Пример #24
0
 /**
  * Method to determine whether a storage entry has been set for a key.
  *
  * @param   string  $key  The storage entry identifier.
  *
  * @return  boolean
  *
  * @since   1.0
  */
 protected function exists($key)
 {
     return wincache_ucache_exists($key);
 }
Пример #25
0
 /**
  * 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)
 {
     return wincache_ucache_exists($id);
 }
Пример #26
0
 /**
 +----------------------------------------------------------
 * 读取缓存
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @param string $name 缓存变量名
 +----------------------------------------------------------
 * @return mixed
 +----------------------------------------------------------
 */
 public function get($name)
 {
     N('cache_read', 1);
     return wincache_ucache_exists($name) ? wincache_ucache_get($name) : false;
 }
Пример #27
0
 /**
  * {@inheritDoc}
  */
 protected function containsEntry($id)
 {
     return wincache_ucache_exists($id);
 }
Пример #28
0
 /**
  * {@inheritdoc}
  */
 protected function doContains($id)
 {
     return wincache_ucache_exists($id);
 }
Пример #29
0
    /**
     * Internal method to replace an existing item.
     *
     * Options:
     *  - ttl <float>
     *    - The time-to-life
     *  - namespace <string>
     *    - The namespace to use
     *
     * @param  string $normalizedKey
     * @param  mixed  $value
     * @param  array  $normalizedOptions
     * @return boolean
     * @throws Exception\ExceptionInterface
     */
    protected function internalReplaceItem(& $normalizedKey, & $value, array & $normalizedOptions)
    {
        $internalKey = $normalizedOptions['namespace'] . $this->getOptions()->getNamespaceSeparator() . $normalizedKey;
        if (!wincache_ucache_exists($internalKey)) {
            return false;
        }

        if (!wincache_ucache_set($internalKey, $value, $normalizedOptions['ttl'])) {
            $type = is_object($value) ? get_class($value) : gettype($value);
            throw new Exception\RuntimeException(
                "wincache_ucache_set('{$internalKey}', <{$type}>, {$normalizedOptions['ttl']}) failed"
            );
        }

        return true;
    }