aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggSharedMemoryCache.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/classes/ElggSharedMemoryCache.php')
-rw-r--r--engine/classes/ElggSharedMemoryCache.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/engine/classes/ElggSharedMemoryCache.php b/engine/classes/ElggSharedMemoryCache.php
new file mode 100644
index 000000000..cae78943e
--- /dev/null
+++ b/engine/classes/ElggSharedMemoryCache.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Shared memory cache description.
+ * Extends ElggCache with functions useful to shared memory style caches (static variables, memcache etc)
+ */
+abstract class ElggSharedMemoryCache extends ElggCache {
+ /**
+ * Namespace variable used to keep various bits of the cache
+ * separate.
+ *
+ * @var string
+ */
+ private $namespace;
+
+ /**
+ * Set the namespace of this cache.
+ * This is useful for cache types (like memcache or static variables) where there is one large
+ * flat area of memory shared across all instances of the cache.
+ *
+ * @param string $namespace
+ */
+ public function setNamespace($namespace = "default") {
+ $this->namespace = $namespace;
+ }
+
+ /**
+ * Get the namespace currently defined.
+ *
+ * @return string
+ */
+ public function getNamespace() {
+ return $this->namespace;
+ }
+} \ No newline at end of file