示例#1
0
 /**
  * Set the namespace of this cache.
  *
  * This will also add the Memcache namespace prefix as defined in settings.php
  *
  * @param string $namespace Namespace for cache
  *
  * @return void
  */
 public function setNamespace($namespace = "default")
 {
     $config_prefix = _elgg_services()->config->getVolatile('memcache_namespace_prefix');
     if ($config_prefix) {
         $namespace = $config_prefix . $namespace;
     }
     parent::setNamespace($namespace);
 }
示例#2
0
文件: ElggEntity.php 项目: elgg/elgg
 /**
  * Cache the entity in a persisted cache
  *
  * @param ElggSharedMemoryCache $cache       Memcache or null cache
  * @param int                   $last_action Last action time
  *
  * @return void
  * @access private
  * @internal
  */
 public function storeInPersistedCache(\ElggSharedMemoryCache $cache, $last_action = 0)
 {
     $tmp = $this->volatile;
     // don't store volatile data
     $this->volatile = [];
     if ($last_action) {
         $this->attributes['last_action'] = (int) $last_action;
     }
     $cache->save($this->guid, $this);
     $this->volatile = $tmp;
 }
示例#3
0
 /**
  * Set the namespace of this cache.
  *
  * This will also add the Memcache namespace prefix as defined in settings.php
  *
  * @param string $namespace Namespace for cache
  *
  * @return void
  */
 public function setNamespace($namespace = "default")
 {
     if (isset($this->CONFIG->memcache_namespace_prefix)) {
         $namespace = $this->CONFIG->memcache_namespace_prefix . $namespace;
     }
     parent::setNamespace($namespace);
 }