SchemaCache

  1. drupal
    1. 7 includes/bootstrap.inc
    2. 8 core/lib/Drupal/Core/Utility/SchemaCache.php

Extends DrupalCacheArray to allow for dynamic building of the schema cache.

Hierarchy

Properties

NameDescription
DrupalCacheArray::$binA bin to pass to cache_set() and cache_get().
DrupalCacheArray::$cidA cid to pass to cache_set() and cache_get().
DrupalCacheArray::$keysToPersistAn array of keys to add to the cache at the end of the request.
DrupalCacheArray::$storageStorage for the data itself.

Functions & methods

NameDescription
DrupalCacheArray::offsetExistsImplements ArrayAccess::offsetExists().
DrupalCacheArray::offsetGetImplements ArrayAccess::offsetGet().
DrupalCacheArray::offsetSetImplements ArrayAccess::offsetSet().
DrupalCacheArray::offsetUnsetImplements ArrayAccess::offsetUnset().
DrupalCacheArray::persistFlags an offset value to be written to the persistent cache.
DrupalCacheArray::setWrites a value to the persistent cache immediately.
DrupalCacheArray::__destructDestructs the DrupalCacheArray object.
SchemaCache::resolveCacheMissOverrides DrupalCacheArray::resolveCacheMiss(). Overrides DrupalCacheArray::resolveCacheMiss
SchemaCache::__constructConstructs a SchemaCache object. Overrides DrupalCacheArray::__construct

File

includes/bootstrap.inc, line 2872
Functions that need to be loaded on every Drupal request.

View source
class SchemaCache extends DrupalCacheArray {

  /**
   * Constructs a SchemaCache object.
   */
  public function __construct() {
    // Cache by request method.
    parent::__construct('schema:runtime:' . ($_SERVER['REQUEST_METHOD'] == 'GET'), 'cache');
  }

  /**
   * Overrides DrupalCacheArray::resolveCacheMiss().
   */
  protected function resolveCacheMiss($offset) {
    $complete_schema = drupal_get_complete_schema();
    $value = isset($complete_schema[$offset]) ? $complete_schema[$offset] :  NULL;
    $this->storage[$offset] = $value;
    $this->persist($offset);
    return $value;
  }
}

Related topics

Login or register to post comments