TYPO3 CMS  TYPO3_6-2
ClassInfoCache.php
Go to the documentation of this file.
1 <?php
3 
22 
26  private $level1Cache = array();
27 
31  private $level2Cache;
32 
36  public function __construct() {
37  $this->initializeLevel2Cache();
38  }
39 
46  public function has($id) {
47  return isset($this->level1Cache[$id]) || $this->level2Cache->has($id);
48  }
49 
56  public function get($id) {
57  if (!isset($this->level1Cache[$id])) {
58  $this->level1Cache[$id] = $this->level2Cache->get($id);
59  }
60  return $this->level1Cache[$id];
61  }
62 
69  public function set($id, $value) {
70  $this->level1Cache[$id] = $value;
71  $this->level2Cache->set($id, $value);
72  }
73 
77  private function initializeLevel2Cache() {
78  $this->level2Cache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('extbase_object');
79  }
80 }