From 0cdad21cb38337255761b53513d5626674ab7986 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 4 Jun 2009 15:04:36 +0000 Subject: [PATCH] Introduce XCache and eAccelerator, make some small changes to the abstract, forgot a period in the command for r9537 :( git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9538 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acm/acm_eaccelerator.php | 123 ++++++++++++++++++++++++ phpBB/includes/acm/acm_memory.php | 15 ++- phpBB/includes/acm/acm_xcache.php | 106 ++++++++++++++++++++ 3 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 phpBB/includes/acm/acm_eaccelerator.php create mode 100644 phpBB/includes/acm/acm_xcache.php diff --git a/phpBB/includes/acm/acm_eaccelerator.php b/phpBB/includes/acm/acm_eaccelerator.php new file mode 100644 index 0000000000..3697fb5202 --- /dev/null +++ b/phpBB/includes/acm/acm_eaccelerator.php @@ -0,0 +1,123 @@ +serialize_header . 'O:') === 0) + { + $result = unserialize(substr($result, strlen($this->serialize_header))); + } + + return $result; + } + + /** + * 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) + { + // Serialize objects and make them easy to detect + $data = (is_object($data)) ? $this->serialize_header . serialize($data) : $data; + + return eaccelerator_put($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 eaccelerator_rm($var); + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index 7875c3441e..a97f680d1e 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -228,7 +228,7 @@ class acm_memory { if ($var_name[0] == '_') { - return true; + return $this->_isset($var_name); } else { @@ -398,6 +398,19 @@ class acm_memory return @unlink($filename); } + + /** + * Check if a cache var exists + * + * @access protected + * @param string $var Cache key + * @return bool True if it exists, otherwise false + */ + function _isset($var) + { + // Most caches don't need to check + return true; + } } ?> \ No newline at end of file diff --git a/phpBB/includes/acm/acm_xcache.php b/phpBB/includes/acm/acm_xcache.php new file mode 100644 index 0000000000..36a32c167e --- /dev/null +++ b/phpBB/includes/acm/acm_xcache.php @@ -0,0 +1,106 @@ + \ No newline at end of file