class ApcCache

Uses APC to cache files

@author André Roaldseth <andre@roaldseth.net>

Hierarchy

Expanded class hierarchy of ApcCache

1 file declares its use of ApcCache
ApcCacheTest.php in drupal/core/vendor/kriswallsmith/assetic/tests/Assetic/Test/Cache/ApcCacheTest.php

File

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

Namespace

Assetic\Cache
View source
class ApcCache implements CacheInterface {
  public $ttl = 0;

  /**
   * @see CacheInterface::has()
   */
  public function has($key) {
    return apc_exists($key);
  }

  /**
   * @see CacheInterface::get()
   */
  public function get($key) {
    $value = apc_fetch($key, $success);
    if (!$success) {
      throw new \RuntimeException('There is no cached value for ' . $key);
    }
    return $value;
  }

  /**
   * @see CacheInterface::set()
   */
  public function set($key, $value) {
    $store = apc_store($key, $value, $this->ttl);
    if (!$store) {
      throw new \RuntimeException('Unable to store "' . $key . '" for ' . $this->ttl . ' seconds.');
    }
    return $store;
  }

  /**
   * @see CacheInterface::remove()
   */
  public function remove($key) {
    return apc_delete($key);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ApcCache::$ttl public property
ApcCache::get public function Overrides CacheInterface::get
ApcCache::has public function Overrides CacheInterface::has
ApcCache::remove public function Overrides CacheInterface::remove
ApcCache::set public function Overrides CacheInterface::set