diff options
author | ChrisTX <ChrisTX@code.phpbb.com> | 2010-11-21 23:02:56 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2010-12-13 00:14:57 +0100 |
commit | d7287ec633577886e5f92543c2a610d4aaa93d53 (patch) | |
tree | 9c75f98f3640ff95370ca99c2a6749db9b2d20e9 /phpBB/includes/acm/acm_wincache.php | |
parent | 500f0c05dbd625feb42f04fd463c8d17498f321b (diff) | |
download | forums-d7287ec633577886e5f92543c2a610d4aaa93d53.tar forums-d7287ec633577886e5f92543c2a610d4aaa93d53.tar.gz forums-d7287ec633577886e5f92543c2a610d4aaa93d53.tar.bz2 forums-d7287ec633577886e5f92543c2a610d4aaa93d53.tar.xz forums-d7287ec633577886e5f92543c2a610d4aaa93d53.zip |
[feature/acm-wincache] Adding caching module for WinCache's User Cache.
PHPBB3-9942
Diffstat (limited to 'phpBB/includes/acm/acm_wincache.php')
-rw-r--r-- | phpBB/includes/acm/acm_wincache.php | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/phpBB/includes/acm/acm_wincache.php b/phpBB/includes/acm/acm_wincache.php new file mode 100644 index 0000000000..0501ab74c5 --- /dev/null +++ b/phpBB/includes/acm/acm_wincache.php @@ -0,0 +1,84 @@ +<?php +/** +* +* @package acm +* @copyright (c) 2010 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')) +{ + require("{$phpbb_root_path}includes/acm/acm_memory.$phpEx"); +} + +/** +* ACM for WinCache +* @package acm +*/ +class acm extends acm_memory +{ + var $extension = 'wincache'; + + /** + * Purge cache data + * + * @return void + */ + function purge() + { + wincache_ucache_clear(); + + parent::purge(); + } + + /** + * Fetch an item from the cache + * + * @access protected + * @param string $var Cache key + * @return mixed Cached data + */ + function _read($var) + { + $success = false; + $result = wincache_ucache_get($this->key_prefix . $var, $success); + + return ($success) ? $result : false; + } + + /** + * 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) + { + return wincache_ucache_set($this->key_prefix . $var, $data, $ttl); + } + + /** + * Remove an item from the cache + * + * @access protected + * @param string $var Cache key + * @return bool True if the operation succeeded + */ + function _delete($var) + { + return wincache_ucache_delete($this->key_prefix . $var); + } +} |