cache

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

Set and Get Drupal cache data

Drupal has an inbuilt caching system, but it needs to be used effectively to get any benefit from it. For data accessed many times during the same request, data should be statically cached. If it's consistent over a longer period of time, it should also be added to the core cache.

The following is my template code that I used any time I need to pull something from the cache. I modify it based on what I expect to happen to the data.

Subscribe to RSS - cache