1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/includes/acm/acm_apc.php Wed Mar 07 16:41:10 2012 +0400
1.3 @@ -0,0 +1,84 @@
1.4 +<?php
1.5 +/**
1.6 +*
1.7 +* @package acm
1.8 +* @version $Id$
1.9 +* @copyright (c) 2005, 2009 phpBB Group
1.10 +* @license http://opensource.org/licenses/gpl-license.php GNU Public License
1.11 +*
1.12 +*/
1.13 +
1.14 +/**
1.15 +* @ignore
1.16 +*/
1.17 +if (!defined('IN_PHPBB'))
1.18 +{
1.19 + exit;
1.20 +}
1.21 +
1.22 +// Include the abstract base
1.23 +if (!class_exists('acm_memory'))
1.24 +{
1.25 + require("{$phpbb_root_path}includes/acm/acm_memory.$phpEx");
1.26 +}
1.27 +
1.28 +/**
1.29 +* ACM for APC
1.30 +* @package acm
1.31 +*/
1.32 +class acm extends acm_memory
1.33 +{
1.34 + var $extension = 'apc';
1.35 +
1.36 + /**
1.37 + * Purge cache data
1.38 + *
1.39 + * @return void
1.40 + */
1.41 + function purge()
1.42 + {
1.43 + apc_clear_cache('user');
1.44 +
1.45 + parent::purge();
1.46 + }
1.47 +
1.48 + /**
1.49 + * Fetch an item from the cache
1.50 + *
1.51 + * @access protected
1.52 + * @param string $var Cache key
1.53 + * @return mixed Cached data
1.54 + */
1.55 + function _read($var)
1.56 + {
1.57 + return apc_fetch($this->key_prefix . $var);
1.58 + }
1.59 +
1.60 + /**
1.61 + * Store data in the cache
1.62 + *
1.63 + * @access protected
1.64 + * @param string $var Cache key
1.65 + * @param mixed $data Data to store
1.66 + * @param int $ttl Time-to-live of cached data
1.67 + * @return bool True if the operation succeeded
1.68 + */
1.69 + function _write($var, $data, $ttl = 2592000)
1.70 + {
1.71 + return apc_store($this->key_prefix . $var, $data, $ttl);
1.72 + }
1.73 +
1.74 + /**
1.75 + * Remove an item from the cache
1.76 + *
1.77 + * @access protected
1.78 + * @param string $var Cache key
1.79 + * @return bool True if the operation succeeded
1.80 + */
1.81 + function _delete($var)
1.82 + {
1.83 + return apc_delete($this->key_prefix . $var);
1.84 + }
1.85 +}
1.86 +
1.87 +?>
1.88 \ No newline at end of file