Source for file apc.php
Documentation is available at apc.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* APC cache storage handler
* @package Joomla.Platform
* @see http://php.net/manual/en/book.apc.php
* Get cached data from APC by id and group
* @param string $id The cache data id
* @param string $group The cache data group
* @param boolean $checkTime True to verify cache time expiration threshold
* @return mixed Boolean False on failure or a cached data string
public function get($id, $group, $checkTime =
true)
return apc_fetch($cache_id);
$allinfo =
apc_cache_info('user');
$keys =
$allinfo['cache_list'];
if ($namearr !==
false &&
$namearr[0] ==
$secret &&
$namearr[1] ==
'cache')
if (!isset
($data[$group]))
$item->updateSize($key['mem_size'] /
1024);
* Store the data to APC by id and group
* @param string $id The cache data id
* @param string $group The cache data group
* @param string $data The data to store in cache
* @return boolean True on success, false otherwise
public function store($id, $group, $data)
return apc_store($cache_id, $data, $this->_lifetime);
* Remove a cached data entry by id and group
* @param string $id The cache data id
* @param string $group The cache data group
* @return boolean True on success, false otherwise
public function remove($id, $group)
return apc_delete($cache_id);
* Clean cache for a group given a mode.
* group mode : cleans all cache in the group
* notgroup mode : cleans all cache not in the group
* @param string $group The cache data group
* @param string $mode The mode for cleaning cache [group|notgroup]
* @return boolean True on success, false otherwise
public function clean($group, $mode =
null)
$allinfo =
apc_cache_info('user');
$keys =
$allinfo['cache_list'];
if (strpos($key['info'], $secret .
'-cache-' .
$group .
'-') ===
0 xor $mode !=
'group')
apc_delete($key['info']);
* Force garbage collect expired cache data as items are removed only on fetch!
* @return boolean True on success, false otherwise.
$allinfo =
apc_cache_info('user');
$keys =
$allinfo['cache_list'];
if (strpos($key['info'], $secret .
'-cache-'))
* Test to see if the cache storage is available.
* @return boolean True on success, false otherwise.
* Lock cached item - override parent as this is more efficient
* @param string $id The cache data id
* @param string $group The cache data group
* @param integer $locktime Cached item max lock time
* @return object Properties are lock and locklooped
public function lock($id, $group, $locktime)
$returning =
new stdClass;
$returning->locklooped =
false;
$looptime =
$locktime *
10;
$data_lock =
apc_add($cache_id, 1, $locktime);
if ($data_lock ===
false)
// Loop until you find that the lock has been released.
// That implies that data get from other thread has finished
while ($data_lock ===
false)
if ($lock_counter >
$looptime)
$returning->locked =
false;
$returning->locklooped =
true;
$data_lock =
apc_add($cache_id, 1, $locktime);
$returning->locked =
$data_lock;
* Unlock cached item - override parent for cacheid compatibility with lock
* @param string $id The cache data id
* @param string $group The cache data group
* @return boolean True on success, false otherwise.
public function unlock($id, $group =
null)
$unlock =
apc_delete($cache_id);
Documentation generated on Tue, 19 Nov 2013 14:53:43 +0100 by phpDocumentor 1.4.3