Ejemplo n.º 1
0
 /**
  * @param CacheKey $key
  * @depreciated
  */
 public function clearModule(CacheKey $key)
 {
     $module = $key->getModule();
     $iterator = new \APCIterator('user');
     while ($iterator->current()) {
         $tKey = $iterator->key();
         if (mb_strpos($tKey, $module . '||') !== false) {
             apc_delete($tKey);
         }
         $iterator->next();
     }
 }
Ejemplo n.º 2
0
 public function set(CacheKey $key, $value, $sessionLength = null)
 {
     $module = $key->getModule();
     $property = $key->getProperty();
     if ($sessionLength == null) {
         $sessionLength = $this->timeThreshold;
     }
     if (!isset($this->elements[$module][$property])) {
         $this->elements[$module][$property] = new FileElement($value, time() + $sessionLength);
     } else {
         /** @noinspection PhpUndefinedMethodInspection */
         $this->elements[$module][$property]->set($value, time() + $sessionLength);
     }
     if (!isset($_SESSION[$this->cacheMaintenanceTimeName][$module])) {
         $_SESSION[$this->cacheMaintenanceTimeName][$module] = time() + $sessionLength;
     }
     $this->changed = true;
 }
Ejemplo n.º 3
0
 /**
  * Unset cache value
  * @param CacheKey $key
  */
 public function clear(CacheKey $key)
 {
     unset($this->cache[$key->getModule()][$key->getProperty()]);
 }
Ejemplo n.º 4
0
 /**
  * @param CacheKey $key
  * @return string
  */
 protected function getKey(CacheKey $key)
 {
     return static::$sCachePrefix . '__' . $key->getModule() . '||' . $key->getProperty();
 }
Ejemplo n.º 5
0
 public function clear(CacheKey $key)
 {
     $module = $key->getModule();
     $id = $key->getProperty();
     if (!empty($id)) {
         unset($_SESSION[$this->cacheName][$module][$id]);
     } else {
         unset($_SESSION[$this->cacheName][$module]);
     }
 }