2009-06-04 14:00:34 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package acm
|
|
|
|
* @version $Id$
|
|
|
|
* @copyright (c) 2005, 2009 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
if (!defined('IN_PHPBB'))
|
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Include the abstract base
|
|
|
|
if (!class_exists('acm_memory'))
|
|
|
|
{
|
2009-06-05 15:40:56 +00:00
|
|
|
require("{$phpbb_root_path}includes/acm/acm_memory.$phpEx");
|
2009-06-04 14:00:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ACM for APC
|
|
|
|
* @package acm
|
|
|
|
*/
|
|
|
|
class acm extends acm_memory
|
|
|
|
{
|
2009-06-04 15:37:53 +00:00
|
|
|
var $extension = 'apc';
|
|
|
|
|
2009-06-04 14:00:34 +00:00
|
|
|
/**
|
|
|
|
* Purge cache data
|
2009-06-04 14:34:07 +00:00
|
|
|
*
|
|
|
|
* @return void
|
2009-06-04 14:00:34 +00:00
|
|
|
*/
|
|
|
|
function purge()
|
|
|
|
{
|
|
|
|
apc_clear_cache('user');
|
|
|
|
|
|
|
|
parent::purge();
|
|
|
|
}
|
|
|
|
|
2009-06-04 14:34:07 +00:00
|
|
|
/**
|
|
|
|
* Fetch an item from the cache
|
|
|
|
*
|
|
|
|
* @access protected
|
|
|
|
* @param string $var Cache key
|
|
|
|
* @return mixed Cached data
|
|
|
|
*/
|
|
|
|
function _read($var)
|
2009-06-04 14:00:34 +00:00
|
|
|
{
|
2009-06-04 15:59:42 +00:00
|
|
|
return apc_fetch($this->key_prefix . $var);
|
2009-06-04 14:00:34 +00:00
|
|
|
}
|
|
|
|
|
2009-06-04 14:34:07 +00:00
|
|
|
/**
|
|
|
|
* Store data in the cache
|
|
|
|
*
|
|
|
|
* @access protected
|
|
|
|
* @param string $var Cache key
|
|
|
|
* @param mixed $data Data to store
|
|
|
|
* @param int $ttl Time-to-live of cached data
|
|
|
|
* @return bool True if the operation succeeded
|
|
|
|
*/
|
|
|
|
function _write($var, $data, $ttl = 2592000)
|
2009-06-04 14:00:34 +00:00
|
|
|
{
|
2009-06-04 15:59:42 +00:00
|
|
|
return apc_store($this->key_prefix . $var, $data, $ttl);
|
2009-06-04 14:00:34 +00:00
|
|
|
}
|
|
|
|
|
2009-06-04 14:34:07 +00:00
|
|
|
/**
|
|
|
|
* Remove an item from the cache
|
|
|
|
*
|
|
|
|
* @access protected
|
|
|
|
* @param string $var Cache key
|
|
|
|
* @return bool True if the operation succeeded
|
|
|
|
*/
|
|
|
|
function _delete($var)
|
2009-06-04 14:00:34 +00:00
|
|
|
{
|
2009-06-04 15:59:42 +00:00
|
|
|
return apc_delete($this->key_prefix . $var);
|
2009-06-04 14:00:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|