Create schema
BTMash - April 10, 2009 - 16:42
| Project: | Path Cache |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Jump to:
Description
Even though you recommend using this with memcached, it would make sense to create the db tables that should go with it (would allow you to test it out with the db, then the user could gracefully move on to memcache or any other caching mechanism). Now I'm not entirely sure of the best approach in this scenario
function pathcache_schema() {
$schema['cache_pathsrc'] = array(
'description' => 'Cache table for caching the path destination of a URL Alias.',
'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),
'headers' => array(
'description' => 'Any custom HTTP headers to be added to cached data.',
'type' => 'text',
'not null' => FALSE),
'serialized' => array(
'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 0)
),
'indexes' => array('expire' => array('expire')),
'primary key' => array('cid'),
);
$schema['cache_pathsrc'] = $schema['cache_pathdst'];
$schema['cache_pathsrc']['description'] = 'Cache table for caching the path source of a URL alias.'
return $schema;
}or would it be better to go with:
function pathcache_schema() {
$system_schema = system_schema();
$schema['cache_pathdst'] = $schema['cache_pathsrc'] = $system_schema['cache'];
$schema['cache_pathsrc']['description'] = 'Cache table for caching the path source of a URL alias.';
$schema['cache_pathdst']['description'] = 'Cache table for caching the path destination of a URL alias.';
return $schema;
}The latter would be able to follow along with what the drupal cache is at a little more easily?

#1
Considering that the latter is how Drupal creates its cache tables, I see no reason not to use it...
#2
I'm confused. The .install file already does this.