public function DatabaseBackend::schemaDefinition

Defines the schema for the cache bin and cache_tags table.

1 call to DatabaseBackend::schemaDefinition()
DatabaseBackend::ensureBinExists in drupal/core/lib/Drupal/Core/Cache/DatabaseBackend.php
Check if the cache bin exists and create it if not.

File

drupal/core/lib/Drupal/Core/Cache/DatabaseBackend.php, line 466
Definition of Drupal\Core\Cache\DatabaseBackend.

Class

DatabaseBackend
Defines a default cache implementation.

Namespace

Drupal\Core\Cache

Code

public function schemaDefinition() {
  $schema['bin'] = array(
    'description' => 'Storage for the cache API.',
    'fields' => array(
      'cid' => array(
        'description' => 'Primary Key: Unique cache ID.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'data' => array(
        'description' => 'A collection of data to cache.',
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      ),
      'expire' => array(
        'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'created' => array(
        'description' => 'A Unix timestamp indicating when the cache entry was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'serialized' => array(
        'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ),
      'tags' => array(
        'description' => 'Space-separated list of cache tags for this entry.',
        'type' => 'text',
        'size' => 'big',
        'not null' => FALSE,
      ),
      'checksum_invalidations' => array(
        'description' => 'The tag invalidation sum when this entry was saved.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'checksum_deletions' => array(
        'description' => 'The tag deletion sum when this entry was saved.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'expire' => array(
        'expire',
      ),
    ),
    'primary key' => array(
      'cid',
    ),
  );
  $schema['cache_tags'] = array(
    'description' => 'Cache table for tracking cache tags related to the cache bin.',
    'fields' => array(
      'tag' => array(
        'description' => 'Namespace-prefixed tag string.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'invalidations' => array(
        'description' => 'Number incremented when the tag is invalidated.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'deletions' => array(
        'description' => 'Number incremented when the tag is deleted.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'tag',
    ),
  );
  return $schema;
}