You are here

public function DatabaseRawBackend::schemaDefinition in Supercache 8

Same name and namespace in other branches
  1. 2.0.x src/Cache/DatabaseRawBackend.php \Drupal\supercache\Cache\DatabaseRawBackend::schemaDefinition()

Defines the schema for the {cache_*} bin tables.

1 call to DatabaseRawBackend::schemaDefinition()
DatabaseRawBackend::ensureBinExists in src/Cache/DatabaseRawBackend.php
Check if the cache bin exists and create it if not.

File

src/Cache/DatabaseRawBackend.php, line 531
Contains \Drupal\supercache\Cache\DatabaseRawBackend.

Class

DatabaseRawBackend
Defines a default cache implementation.

Namespace

Drupal\supercache\Cache

Code

public function schemaDefinition() {
  $schema = array(
    'description' => 'Storage for the cache API.',
    'fields' => array(
      'cid' => array(
        'description' => 'Primary Key: Unique cache ID.',
        'type' => 'varchar_ascii',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'binary' => TRUE,
      ),
      'data_serialized' => array(
        'description' => 'Cache when data is serialized',
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      ),
      'data_string' => array(
        'description' => 'Cache data when string.',
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
      ),
      'data_int' => array(
        'description' => 'Cache data when integer.',
        'type' => 'int',
        'not null' => FALSE,
        'size' => 'big',
      ),
      'data_float' => array(
        'description' => 'Cache data when float',
        'type' => 'float',
        'not null' => FALSE,
      ),
      'expire' => array(
        'description' => 'A Unix timestamp indicating when the cache entry should expire, or ' . CacheRawBackendInterface::CACHE_PERMANENT . ' for never.',
        'type' => 'int',
        'not null' => TRUE,
        'size' => 'big',
        'default' => 0,
      ),
      'storage' => array(
        'description' => 'A flag to indicate the storage type: 0 => serialized, 1 => string, 2 => integer, 3 => float',
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
      ),
    ),
    'indexes' => array(
      'expire' => array(
        'expire',
      ),
    ),
    'primary key' => array(
      'cid',
    ),
  );
  return $schema;
}