You are here

class CacheStub in Drupal driver for SQL Server and SQL Azure 8.2

Stub implementation for the cache backend.

Hierarchy

Expanded class hierarchy of CacheStub

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Component/CacheStub.php, line 8

Namespace

Drupal\Driver\Database\sqlsrv\Component
View source
class CacheStub implements CacheInterface {
  private $prefix = null;

  /**
   * This cache stores everything in-memory during the
   * lifetime of this request.
   *
   * @var array
   */
  private $data = [];
  public function __construct($prefix) {
    $this->prefix = $prefix;
  }

  /**
   * {@inheritdoc}
   */
  public function Set($cid, $data) {
    $cache = new \stdClass();
    $cache->data = $data;
    $cache->serialized = false;
    $cache->timestamp = time();
    $this->data[$cid] = clone $cache;
  }

  /**
   * {@inheritdoc}
   */
  public function Get($cid) {
    if (isset($this->data[$cid])) {
      return $this->data[$cid];
    }
    return false;
  }

  /**
   * {@inheritdoc}
   */
  public function Clear($cid) {
    unset($this->data[$cid]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheStub::$data private property This cache stores everything in-memory during the lifetime of this request.
CacheStub::$prefix private property
CacheStub::Clear public function Clear a cache item. Overrides CacheInterface::Clear
CacheStub::Get public function Get a cache item. Overrides CacheInterface::Get
CacheStub::Set public function Set a cache item. Overrides CacheInterface::Set
CacheStub::__construct public function