diff options
author | Andreas Fischer <bantu@phpbb.com> | 2010-12-13 15:05:22 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2010-12-13 15:05:22 +0100 |
commit | 7c9002398aa9e178bb5368f3f4ec58e935b5c5a8 (patch) | |
tree | 195425fc308af95d8484a0a99bdc393abfce104f /phpBB | |
parent | 2c25a4bbb2d1dfa46275635f92beebbf7b68bf6d (diff) | |
parent | d7287ec633577886e5f92543c2a610d4aaa93d53 (diff) | |
download | forums-7c9002398aa9e178bb5368f3f4ec58e935b5c5a8.tar forums-7c9002398aa9e178bb5368f3f4ec58e935b5c5a8.tar.gz forums-7c9002398aa9e178bb5368f3f4ec58e935b5c5a8.tar.bz2 forums-7c9002398aa9e178bb5368f3f4ec58e935b5c5a8.tar.xz forums-7c9002398aa9e178bb5368f3f4ec58e935b5c5a8.zip |
Merge branch 'feature/ChrisTX/acm-wincache' into develop-olympus
* feature/ChrisTX/acm-wincache:
[feature/acm-wincache] Adding caching module for WinCache's User Cache.
Diffstat (limited to 'phpBB')
-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); + } +} |