includes/acm/acm_apc.php
author indvdum (gotoindvdum[at]gmail[dot]com)
Sat, 10 Mar 2012 00:47:37 +0400
changeset 16 d6012dd9347f
parent 0 ceef6d64c21d
permissions -rw-r--r--
Removing old cubometry-style style
     1 <?php
     2 /**
     3 *
     4 * @package acm
     5 * @version $Id$
     6 * @copyright (c) 2005, 2009 phpBB Group
     7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
     8 *
     9 */
    10 
    11 /**
    12 * @ignore
    13 */
    14 if (!defined('IN_PHPBB'))
    15 {
    16 	exit;
    17 }
    18 
    19 // Include the abstract base
    20 if (!class_exists('acm_memory'))
    21 {
    22 	require("{$phpbb_root_path}includes/acm/acm_memory.$phpEx");
    23 }
    24 
    25 /**
    26 * ACM for APC
    27 * @package acm
    28 */
    29 class acm extends acm_memory
    30 {
    31 	var $extension = 'apc';
    32 
    33 	/**
    34 	* Purge cache data
    35 	*
    36 	* @return void
    37 	*/
    38 	function purge()
    39 	{
    40 		apc_clear_cache('user');
    41 
    42 		parent::purge();
    43 	}
    44 
    45 	/**
    46 	* Fetch an item from the cache
    47 	*
    48 	* @access protected
    49 	* @param string $var Cache key
    50 	* @return mixed Cached data
    51 	*/
    52 	function _read($var)
    53 	{
    54 		return apc_fetch($this->key_prefix . $var);
    55 	}
    56 
    57 	/**
    58 	* Store data in the cache
    59 	*
    60 	* @access protected
    61 	* @param string $var Cache key
    62 	* @param mixed $data Data to store
    63 	* @param int $ttl Time-to-live of cached data
    64 	* @return bool True if the operation succeeded
    65 	*/
    66 	function _write($var, $data, $ttl = 2592000)
    67 	{
    68 		return apc_store($this->key_prefix . $var, $data, $ttl);
    69 	}
    70 
    71 	/**
    72 	* Remove an item from the cache
    73 	*
    74 	* @access protected
    75 	* @param string $var Cache key
    76 	* @return bool True if the operation succeeded
    77 	*/
    78 	function _delete($var)
    79 	{
    80 		return apc_delete($this->key_prefix . $var);
    81 	}
    82 }
    83 
    84 ?>