ElggSharedMemoryCache.php 911 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Shared memory cache description.
  4. * Extends \ElggCache with functions useful to shared memory
  5. * style caches (static variables, memcache etc)
  6. *
  7. * @package Elgg.Core
  8. * @subpackage Cache
  9. */
  10. abstract class ElggSharedMemoryCache extends \ElggCache {
  11. /**
  12. * Namespace variable used to keep various bits of the cache
  13. * separate.
  14. *
  15. * @var string
  16. */
  17. private $namespace;
  18. /**
  19. * Set the namespace of this cache.
  20. * This is useful for cache types (like memcache or static variables) where there is one large
  21. * flat area of memory shared across all instances of the cache.
  22. *
  23. * @param string $namespace Namespace for cache
  24. *
  25. * @return void
  26. */
  27. public function setNamespace($namespace = "default") {
  28. $this->namespace = $namespace;
  29. }
  30. /**
  31. * Get the namespace currently defined.
  32. *
  33. * @return string
  34. */
  35. public function getNamespace() {
  36. return $this->namespace;
  37. }
  38. }