10 defined(
'JPATH_PLATFORM') or die;
33 public function get($id, $group, $checkTime =
true)
35 $cache_id = $this->_getCacheId($id, $group);
36 $cache_content = xcache_get($cache_id);
38 if ($cache_content === null)
43 return $cache_content;
55 public function getAll()
59 $allinfo = xcache_list(XC_TYPE_VAR, 0);
60 $keys = $allinfo[
'cache_list'];
61 $secret = $this->_hash;
65 foreach ($keys as $key)
68 $namearr = explode(
'-', $key[
'name']);
70 if ($namearr !==
false && $namearr[0] == $secret && $namearr[1] ==
'cache')
74 if (!isset($data[$group]))
80 $item = $data[$group];
83 $item->updateSize($key[
'size'] / 1024);
85 $data[$group] = $item;
103 public function store($id, $group, $data)
105 $cache_id = $this->_getCacheId($id, $group);
106 $store = xcache_set($cache_id, $data, $this->_lifetime);
120 public function remove($id, $group)
122 $cache_id = $this->_getCacheId($id, $group);
124 if (!xcache_isset($cache_id))
129 return xcache_unset($cache_id);
146 public function clean($group, $mode = null)
148 $allinfo = xcache_list(XC_TYPE_VAR, 0);
149 $keys = $allinfo[
'cache_list'];
151 $secret = $this->_hash;
152 foreach ($keys as $key)
154 if (strpos($key[
'name'], $secret .
'-cache-' . $group .
'-') === 0 xor $mode !=
'group')
156 xcache_unset($key[
'name']);
205 public static function isSupported()
207 return (extension_loaded(
'xcache'));