aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cache/cache_memory.php
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-10-01 15:00:01 +0200
committerTristan Darricau <github@nicofuma.fr>2014-10-03 23:50:24 +0200
commit8e638dbf6d53be3d8c5b1eda8ce44e7e4f60b75a (patch)
tree7a92af7c477390b22f389163e73f542d2cd4fbfa /tests/cache/cache_memory.php
parent40cd7570e6f4da7cc60d83a3e99c72a2fb99e3f7 (diff)
downloadforums-8e638dbf6d53be3d8c5b1eda8ce44e7e4f60b75a.tar
forums-8e638dbf6d53be3d8c5b1eda8ce44e7e4f60b75a.tar.gz
forums-8e638dbf6d53be3d8c5b1eda8ce44e7e4f60b75a.tar.bz2
forums-8e638dbf6d53be3d8c5b1eda8ce44e7e4f60b75a.tar.xz
forums-8e638dbf6d53be3d8c5b1eda8ce44e7e4f60b75a.zip
[ticket/11224] Revert Revert "Merge pull request #2460 from ticket/11224"
Diffstat (limited to 'tests/cache/cache_memory.php')
-rw-r--r--tests/cache/cache_memory.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/cache/cache_memory.php b/tests/cache/cache_memory.php
new file mode 100644
index 0000000000..c468cb4658
--- /dev/null
+++ b/tests/cache/cache_memory.php
@@ -0,0 +1,62 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2014 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/acm/acm_memory.php';
+
+class phpbb_cache_memory extends acm_memory
+{
+ protected $data = array();
+
+ /**
+ * Set cache path
+ */
+ function phpbb_cache_memory()
+ {
+ }
+
+ /**
+ * Fetch an item from the cache
+ *
+ * @access protected
+ * @param string $var Cache key
+ * @return mixed Cached data
+ */
+ function _read($var)
+ {
+ return $this->data[$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)
+ {
+ $this->data[$var] = $data;
+ return true;
+ }
+
+ /**
+ * Remove an item from the cache
+ *
+ * @access protected
+ * @param string $var Cache key
+ * @return bool True if the operation succeeded
+ */
+ function _delete($var)
+ {
+ unset($this->data[$var]);
+ return true;
+ }
+}