1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/includes/acm/acm_wincache.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 +* @copyright (c) 2010 phpBB Group
1.9 +* @license http://opensource.org/licenses/gpl-license.php GNU Public License
1.10 +*
1.11 +*/
1.12 +
1.13 +/**
1.14 +* @ignore
1.15 +*/
1.16 +if (!defined('IN_PHPBB'))
1.17 +{
1.18 + exit;
1.19 +}
1.20 +
1.21 +// Include the abstract base
1.22 +if (!class_exists('acm_memory'))
1.23 +{
1.24 + require("{$phpbb_root_path}includes/acm/acm_memory.$phpEx");
1.25 +}
1.26 +
1.27 +/**
1.28 +* ACM for WinCache
1.29 +* @package acm
1.30 +*/
1.31 +class acm extends acm_memory
1.32 +{
1.33 + var $extension = 'wincache';
1.34 +
1.35 + /**
1.36 + * Purge cache data
1.37 + *
1.38 + * @return void
1.39 + */
1.40 + function purge()
1.41 + {
1.42 + wincache_ucache_clear();
1.43 +
1.44 + parent::purge();
1.45 + }
1.46 +
1.47 + /**
1.48 + * Fetch an item from the cache
1.49 + *
1.50 + * @access protected
1.51 + * @param string $var Cache key
1.52 + * @return mixed Cached data
1.53 + */
1.54 + function _read($var)
1.55 + {
1.56 + $success = false;
1.57 + $result = wincache_ucache_get($this->key_prefix . $var, $success);
1.58 +
1.59 + return ($success) ? $result : false;
1.60 + }
1.61 +
1.62 + /**
1.63 + * Store data in the cache
1.64 + *
1.65 + * @access protected
1.66 + * @param string $var Cache key
1.67 + * @param mixed $data Data to store
1.68 + * @param int $ttl Time-to-live of cached data
1.69 + * @return bool True if the operation succeeded
1.70 + */
1.71 + function _write($var, $data, $ttl = 2592000)
1.72 + {
1.73 + return wincache_ucache_set($this->key_prefix . $var, $data, $ttl);
1.74 + }
1.75 +
1.76 + /**
1.77 + * Remove an item from the cache
1.78 + *
1.79 + * @access protected
1.80 + * @param string $var Cache key
1.81 + * @return bool True if the operation succeeded
1.82 + */
1.83 + function _delete($var)
1.84 + {
1.85 + return wincache_ucache_delete($this->key_prefix . $var);
1.86 + }
1.87 +}