class ArrayCache

A simple array cache

@author Michael Mifsud <xzyfer@gmail.com>

Hierarchy

Expanded class hierarchy of ArrayCache

File

drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Cache/ArrayCache.php, line 19

Namespace

Assetic\Cache
View source
class ArrayCache implements CacheInterface {
  private $cache = array();

  /**
   * @see CacheInterface::has()
   */
  public function has($key) {
    return isset($this->cache[$key]);
  }

  /**
   * @see CacheInterface::get()
   */
  public function get($key) {
    if (!$this
      ->has($key)) {
      throw new \RuntimeException('There is no cached value for ' . $key);
    }
    return $this->cache[$key];
  }

  /**
   * @see CacheInterface::set()
   */
  public function set($key, $value) {
    $this->cache[$key] = $value;
  }

  /**
   * @see CacheInterface::remove()
   */
  public function remove($key) {
    unset($this->cache[$key]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ArrayCache::$cache private property
ArrayCache::get public function Overrides CacheInterface::get
ArrayCache::has public function Overrides CacheInterface::has
ArrayCache::remove public function Overrides CacheInterface::remove
ArrayCache::set public function Overrides CacheInterface::set