Ejemplo n.º 1
0
 /**
  * Tries to read the configuration from cache, if it's not cached loads it from file and caches it.
  *
  * @return array|object
  */
 private function readFromCache()
 {
     if (($config = $this->cacheConfig->getCacheManager()->get($this->cacheConfig->getKey())) !== null) {
         return $config;
     }
     $config = $this->read();
     $this->cacheConfig->getCacheManager()->set($this->cacheConfig->getKey(), $config, $this->cacheConfig->getTtl());
     return $config;
 }
Ejemplo n.º 2
0
 public function testGetData()
 {
     $object = new CacheConfig($this->data);
     $this->assertSame($this->data, $object->getData());
 }
Ejemplo n.º 3
0
 public static function dmemcache_key($key)
 {
     $prefix = CacheConfig::getCacheKeyPrefix();
     if ($prefix == '') {
         $prefix = 'default';
     }
     $full_key = $prefix . '-' . $key;
     return md5($full_key);
 }