aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggSharedMemoryCache.php
blob: f5f11d2c70f6172d7ad9434edc33609f84e96dd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
 * Shared memory cache description.
 * Extends ElggCache with functions useful to shared memory
 * style caches (static variables, memcache etc)
 *
 * @package    Elgg.Core
 * @subpackage Cache
 */
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 Namespace for cache
	 *
	 * @return void
	 */
	public function setNamespace($namespace = "default") {
		$this->namespace = $namespace;
	}

	/**
	 * Get the namespace currently defined.
	 *
	 * @return string
	 */
	public function getNamespace() {
		return $this->namespace;
	}
}