Adding a cache table for a module
Drupal Core provides a central caching system. If your module has needs for caching that fall outside the default cache tables, it can have its own cache table (or bin) that uses the same interfaces.
Adding a custom cache table is as simple as adding it to the site's install schema.
Drupal 7
/** * Implements hook_schema(). */ function MODULE_schema() { $schema['cache_MODULE'] = drupal_get_schema_unprocessed('system', 'cache'); $schema['cache_MODULE']['description'] = 'Cache table for MODULE information.'; return $schema; }
Drupal 6
/** * Implements hook_schema(). */ function MODULE_schema() { $schema['cache_MODULE'] = drupal_get_schema_unprocessed('system', 'cache'); $schema['cache_MODULE']['description'] = 'Cache table for MODULE information.'; return $schema; } /** * Implements hook_install(). */ function MODULE_install() { drupal_install_schema('cache_MODULE'); } /** * Implements hook_uninstall(). */ function MODULE_uninstall() { drupal_uninstall_schema('cache_MODULE'); }