aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/cache/driver/apc.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2011-01-09 23:58:27 +0100
committerIgor Wiedler <igor@wiedler.ch>2011-01-09 23:58:27 +0100
commit95c683056b85399200e2caaa9aa65edc6843c16f (patch)
treeac11043ba149791a225d587e7a61e34db75a04f6 /phpBB/includes/cache/driver/apc.php
parent5373f8157d8a2619197702c3a00a6bb432ef3e25 (diff)
parent1aef7eb20ee195c7f21d6c5b78653b7c43e669ec (diff)
downloadforums-95c683056b85399200e2caaa9aa65edc6843c16f.tar
forums-95c683056b85399200e2caaa9aa65edc6843c16f.tar.gz
forums-95c683056b85399200e2caaa9aa65edc6843c16f.tar.bz2
forums-95c683056b85399200e2caaa9aa65edc6843c16f.tar.xz
forums-95c683056b85399200e2caaa9aa65edc6843c16f.zip
Merge branch 'task/acm-refactor' into develop
Conflicts: tests/bootstrap.php
Diffstat (limited to 'phpBB/includes/cache/driver/apc.php')
-rw-r--r--phpBB/includes/cache/driver/apc.php76
1 files changed, 76 insertions, 0 deletions
diff --git a/phpBB/includes/cache/driver/apc.php b/phpBB/includes/cache/driver/apc.php
new file mode 100644
index 0000000000..a97cbe4dd1
--- /dev/null
+++ b/phpBB/includes/cache/driver/apc.php
@@ -0,0 +1,76 @@
+<?php
+/**
+*
+* @package acm
+* @version $Id$
+* @copyright (c) 2005, 2009 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* ACM for APC
+* @package acm
+*/
+class phpbb_cache_driver_apc extends phpbb_cache_driver_memory
+{
+ var $extension = 'apc';
+
+ /**
+ * Purge cache data
+ *
+ * @return void
+ */
+ function purge()
+ {
+ apc_clear_cache('user');
+
+ parent::purge();
+ }
+
+ /**
+ * Fetch an item from the cache
+ *
+ * @access protected
+ * @param string $var Cache key
+ * @return mixed Cached data
+ */
+ function _read($var)
+ {
+ return apc_fetch($this->key_prefix . $var);
+ }
+
+ /**
+ * 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 apc_store($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 apc_delete($this->key_prefix . $var);
+ }
+}