You are here

function qpcache_schema in QueryPath 7.2

Same name and namespace in other branches
  1. 6 qpcache/qpcache.install \qpcache_schema()
  2. 7.3 qpcache/qpcache.install \qpcache_schema()

Implementation of hook_schema().

File

qpcache/qpcache.install, line 39
The installer file for qpcache.

Code

function qpcache_schema() {
  $schema['qpcache_xmlcache'] = array(
    'fields' => array(
      // Cache ID
      'cid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      // CRC32 checksum
      'crckey' => array(
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
        'unsigned' => FALSE,
        'default' => 0,
      ),
      // Expiration timestamp
      'expire' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      // Hash key
      'hashkey' => array(
        'type' => 'varchar',
        'length' => 32,
      ),
      // Cleartext key (for DBAs)
      'clearkey' => array(
        'type' => 'text',
      ),
      // XML content
      'body' => array(
        'type' => 'text',
        'size' => 'big',
      ),
    ),
    'primary key' => array(
      'cid',
    ),
    // Collision space for the combination of these two should be miniscule.
    'unique keys' => array(
      'hash' => array(
        'crckey',
        'hashkey',
      ),
    ),
    'indexes' => array(
      // Used for fast seeking
      'by_key' => array(
        'crckey',
        'hashkey',
        'expire',
      ),
      // Used by cache maintanance
      'cacheexpire' => array(
        'expire',
      ),
    ),
  );
  return $schema;
}