Пример #1
1
 public function remove($key)
 {
     if ($key == 'all') {
         return wincache_ucache_clear() ? true : false;
     } else {
         if (wincache_ucache_exists($this->type . '_' . $key)) {
             return wincache_ucache_delete($this->type . '_' . $key) ? true : false;
         }
         return false;
     }
     return false;
 }
Пример #2
0
function cs_cache_delete($name, $ttl = 0)
{
    $token = empty($ttl) ? $name : 'ttl_' . $name;
    if (wincache_ucache_exists($token)) {
        wincache_ucache_delete($token);
    }
}
Пример #3
0
 /**
  * 删除指定key的缓存,若$key===true则表示删除全部
  *
  * @param string $key
  */
 public function delete($key)
 {
     if ($key === true) {
         return $this->delete_all();
     }
     return \wincache_ucache_delete($key);
 }
Пример #4
0
 public function delete($key, $options= array()) {
     $deleted = false;
     if (!isset($options['multiple_object_delete']) || empty($options['multiple_object_delete'])) {
         $deleted= wincache_ucache_delete($this->getCacheKey($key));
     }
     return $deleted;
 }
 public function delete($key)
 {
     if (function_exists('wincache_ucache_delete')) {
         return wincache_ucache_delete($key);
     } else {
         return getMessage('Cache', 'unsupported', 'Wincache');
     }
 }
Пример #6
0
 public function remove($key)
 {
     try {
         return wincache_ucache_delete($key);
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage(), $ex->getCode());
     }
 }
Пример #7
0
 /**
  * (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);
 }
Пример #8
0
 /**
  * Deletes an item out of the cache, or multiple items
  *
  * @param string|array $key
  * @return int
  */
 public function delete($key)
 {
     $delCount = 0;
     foreach (array_filter((array) $key) as $cacheKey) {
         if (wincache_ucache_delete($cacheKey)) {
             ++$delCount;
         }
     }
     return $delCount;
 }
Пример #9
0
 public function clean($group, $mode = null)
 {
     $allinfo = wincache_ucache_info();
     $keys = $allinfo['cache_entries'];
     $secret = $this->_hash;
     foreach ($keys as $key) {
         if (strpos($key['key_name'], $secret . '-cache-' . $group . '-') === 0 xor $mode != 'group') {
             wincache_ucache_delete($key['key_name']);
         }
     }
     return true;
 }
Пример #10
0
 /**
  * Delete all keys from the cache
  *
  * @param bool $check if true will check expiration, otherwise delete all
  * @return bool True if the cache was successfully cleared, false otherwise
  */
 public function clear($check)
 {
     if ($check) {
         return true;
     }
     $info = wincache_ucache_info();
     $cacheKeys = $info['ucache_entries'];
     unset($info);
     foreach ($cacheKeys as $key) {
         wincache_ucache_delete($key['key_name']);
     }
     return true;
 }
Пример #11
0
 public function filter($prefix)
 {
     $prefixLen = strlen($prefix);
     $info = wincache_ucache_info();
     $keysToDelete = array();
     foreach ($info['ucache_entries'] as $entry) {
         if (empty($entry['is_session']) && 0 === strncmp($entry['key_name'], $prefix, $prefixLen)) {
             $keysToDelete[] = $entry['key_name'];
         }
     }
     if ($keysToDelete) {
         wincache_ucache_delete($keysToDelete);
     }
     return true;
 }
 /**
  * {@inheritdoc}
  */
 function loadClass($class)
 {
     // Look if the cache has anything for this class.
     if ($file = wincache_ucache_get($this->prefix . $class)) {
         if (is_file($file)) {
             require $file;
             return;
         }
         wincache_ucache_delete($this->prefix . $class);
     }
     // Resolve cache miss.
     $api = new LoadClassGetFileInjectedApi($class);
     if ($this->finder->apiFindFile($api, $class)) {
         wincache_ucache_set($this->prefix . $class, $api->getFile());
     }
 }
Пример #13
0
 /**
  * {@inheritDoc}
  */
 public function flush($namespace = null)
 {
     if (!$namespace) {
         return wincache_ucache_clear();
     } else {
         $namespace = implode($this->getNamespaceDelimiter(), (array) $namespace);
         $info = wincache_ucache_info(false);
         // iterate over all entries and delete matching
         foreach ($info['ucache_entries'] as $entry) {
             $key = $entry['key_name'];
             if (0 === strpos($key, $namespace)) {
                 wincache_ucache_delete($key);
             }
         }
     }
     return true;
 }
Пример #14
0
 /**
  * 删除缓存
  * @access public
  * @param string $name 缓存变量名
  * @return boolean
  */
 public function rm($name)
 {
     return wincache_ucache_delete($this->options['prefix'] . $name);
 }
Пример #15
0
 /**
  *	Delete cache entry
  *	@return bool
  *	@param $key string
  **/
 function clear($key)
 {
     if (!$this->dsn) {
         return;
     }
     $ndx = $this->prefix . '.' . $key;
     $parts = explode('=', $this->dsn, 2);
     switch ($parts[0]) {
         case 'apc':
             return apc_delete($ndx);
         case 'memcache':
             return memcache_delete($this->ref, $ndx);
         case 'wincache':
             return wincache_ucache_delete($ndx);
         case 'xcache':
             return xcache_unset($ndx);
         case 'folder':
             return is_file($file = $parts[1] . $ndx) && @unlink($file);
     }
     return FALSE;
 }
Пример #16
0
 /**
  *	Clear contents of cache backend
  *	@return bool
  *	@param $suffix string
  *	@param $lifetime int
  **/
 function reset($suffix = NULL, $lifetime = 0)
 {
     if (!$this->dsn) {
         return TRUE;
     }
     $regex = '/' . preg_quote($this->prefix . '.', '/') . '.+?' . preg_quote($suffix, '/') . '/';
     $parts = explode('=', $this->dsn, 2);
     switch ($parts[0]) {
         case 'apc':
             $key = 'info';
         case 'apcu':
             if (empty($key)) {
                 $key = 'key';
             }
             $info = apc_cache_info('users');
             foreach ($info['cache_list'] as $item) {
                 if (preg_match($regex, $item[$key]) && $item['mtime'] + $lifetime < time()) {
                     apc_delete($item[$key]);
                 }
             }
             return TRUE;
         case 'redis':
             $fw = Base::instance();
             $keys = $this->ref->keys($this->prefix . '.*' . $suffix);
             foreach ($keys as $key) {
                 $val = $fw->unserialize($this->ref->get($key));
                 if ($val[1] + $lifetime < time()) {
                     $this->ref->del($key);
                 }
             }
             return TRUE;
         case 'memcache':
             foreach (memcache_get_extended_stats($this->ref, 'slabs') as $slabs) {
                 foreach (array_filter(array_keys($slabs), 'is_numeric') as $id) {
                     foreach (memcache_get_extended_stats($this->ref, 'cachedump', $id) as $data) {
                         if (is_array($data)) {
                             foreach ($data as $key => $val) {
                                 if (preg_match($regex, $key) && $val[1] + $lifetime < time()) {
                                     memcache_delete($this->ref, $key);
                                 }
                             }
                         }
                     }
                 }
             }
             return TRUE;
         case 'wincache':
             $info = wincache_ucache_info();
             foreach ($info['ucache_entries'] as $item) {
                 if (preg_match($regex, $item['key_name']) && $item['use_time'] + $lifetime < time()) {
                     wincache_ucache_delete($item['key_name']);
                 }
             }
             return TRUE;
         case 'xcache':
             return TRUE;
             /* Not supported */
         /* Not supported */
         case 'folder':
             if ($glob = @glob($parts[1] . '*')) {
                 foreach ($glob as $file) {
                     if (preg_match($regex, basename($file)) && filemtime($file) + $lifetime < time()) {
                         @unlink($file);
                     }
                 }
             }
             return TRUE;
     }
     return FALSE;
 }
Пример #17
0
 /**
  * Delete all keys from the cache. This will clear every
  * item in the cache matching the cache config prefix.
  *
  * @param bool $check If true, nothing will be cleared, as entries will
  *   naturally expire in wincache..
  * @return bool True Returns true.
  */
 public function clear($check)
 {
     if ($check) {
         return true;
     }
     $info = wincache_ucache_info();
     $cacheKeys = $info['ucache_entries'];
     unset($info);
     foreach ($cacheKeys as $key) {
         if (strpos($key['key_name'], $this->_config['prefix']) === 0) {
             wincache_ucache_delete($key['key_name']);
         }
     }
     return true;
 }
Пример #18
0
 /**
  * Remove a value from the WinCache object cache
  *
  * @param $key String: cache key
  * @param $time Int: not used in this implementation
  * @return bool
  */
 public function delete($key, $time = 0)
 {
     wincache_ucache_delete($key);
     return true;
 }
Пример #19
0
 /**
  * Destroy this cell collection
  */
 public function __destruct()
 {
     $cacheList = $this->getCellList();
     foreach ($cacheList as $cellID) {
         wincache_ucache_delete($this->cachePrefix . $cellID . '.cache');
     }
 }
Пример #20
0
 /**
  * Key to delete, deletes .old and primary if exists.
  * @param $key
  * @return bool
  */
 function hard_delete($key)
 {
     $key = $this->get_item_key($key);
     return wincache_ucache_delete($key . '_' . $this->_blog_id);
 }
Пример #21
0
 /**
  * Delete from Cache
  *
  * @param	mixed	unique identifier of the item in the cache
  * @return	bool	true on success/false on failure
  */
 public function delete($id)
 {
     return wincache_ucache_delete($id);
 }
Пример #22
0
 /**
 +----------------------------------------------------------
 * 删除缓存
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @param string $name 缓存变量名
 +----------------------------------------------------------
 * @return boolen
 +----------------------------------------------------------
 */
 public function rm($name)
 {
     return wincache_ucache_delete($name);
 }
Пример #23
0
 /**
  * Delete a cache entry via three possible methods...
  *   + Pass a Regular Expression (PCRE) string.
  *      + Requirement: $this->reg_exp_delimiter must be the delimiter.
  *   + Pass a search string with *unix based wild cards (* and ?).
  *   + Pass the key name of the cache entry.
  *
  * @see wincache_ucache_del();
  * @param string;
  * @return array; The number of cache entries deleted.
  */
 public function delete($search)
 {
     $reg_exp = false;
     if ($this->isSearchRegExp($search)) {
         $reg_exp = $search;
     } else {
         if ($this->isSearchWildCard($search)) {
             $reg_exp = $this->getWildCardRegExp($search);
         }
     }
     $key = $search;
     if (is_string($reg_exp) && count($cache_ids_array = $this->getCacheIdsByRegExp($reg_exp)) > 0) {
         $key = $cache_ids_array;
     }
     if ($result = wincache_ucache_delete($key)) {
         $this->clearInfoArrays();
     }
     return $result;
 }
Пример #24
0
 /**
  * Deletes a value with the specified key from cache
  * This is the implementation of the method declared in the parent class.
  * @param string $key the key of the value to be deleted
  * @return boolean if no error happens during deletion
  */
 protected function deleteValue($key)
 {
     return wincache_ucache_delete($key);
 }
Пример #25
0
 /**
  * {@inheritdoc}
  */
 public function remove($key)
 {
     return wincache_ucache_delete($key);
 }
Пример #26
0
 /**
  * Clears the persistent storage.
  * 
  * Clears the persistent storage, i.e. removes all keys. Locks are left
  * intact.
  * 
  * @return void
  */
 public function clear()
 {
     $info = wincache_ucache_info();
     foreach ($info['ucache_entries'] as $entry) {
         if (!$entry['is_session'] && 0 === strpos($entry['key_name'], $this->persistentId)) {
             wincache_ucache_delete($entry['key_name']);
         }
     }
 }
Пример #27
0
 /**
  * Remove an item from the cache.
  *
  * @param  string  $key
  * @return void
  */
 public function forget($key)
 {
     wincache_ucache_delete($this->prefix . $key);
 }
Пример #28
0
 function delete($id, $group = 'default')
 {
     $key = $this->key($id, $group);
     if (in_array($group, $this->no_mc_groups)) {
         unset($this->cache[$key]);
         return true;
     }
     $result = wincache_ucache_delete($key);
     @++$this->stats['delete'];
     $this->group_ops[$group][] = "delete {$id}";
     unset($this->cache[$key]);
     return $result;
 }
Пример #29
0
 /**
  * {@inheritdoc}
  */
 protected function doDelete($id)
 {
     return wincache_ucache_delete($id);
 }
Пример #30
0
 /**
  * Destroy the data for a particular session identifier in the
  * SessionHandler backend.
  *
  * @param   string   $id  The session identifier.
  *
  * @return boolean  True on success, false otherwise.
  */
 public function destroy($id)
 {
     $sess_id = 'sess_' . $id;
     return wincache_ucache_delete($sess_id);
 }