You are here

function views_cache_set in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 8.3 includes/cache.inc \views_cache_set()
  2. 6.3 includes/cache.inc \views_cache_set()
  3. 6.2 includes/cache.inc \views_cache_set()

Set a cached item in the views cache.

This is just a convenience wrapper around cache_set().

Parameters

string $cid: The cache ID of the data to store.

mixed $data: The data to store in the cache. Complex data types will be automatically serialized before insertion. Strings will be stored as plain text and not serialized.

bool $use_language: If TRUE, the data will be cached specific to the currently active language.

4 calls to views_cache_set()
views_block_info in ./views.module
Implements hook_block_info().
views_plugin_display::init in plugins/views_plugin_display.inc
_views_fetch_data in includes/cache.inc
Fetch Views' data from the cache.
_views_fetch_data_build in includes/cache.inc
Build and set the views data cache if empty.

File

includes/cache.inc, line 184
Load Views' data so that it knows what is available to build queries from.

Code

function views_cache_set($cid, $data, $use_language = FALSE) {
  global $language;
  if (variable_get('views_skip_cache', FALSE)) {
    return;
  }
  if ($use_language) {
    $cid .= ':' . $language->language;
  }
  cache_set($cid, $data, 'cache_views');
}