function views_plugin_cache::cache_set

3.x views_plugin_cache.inc views_plugin_cache::cache_set($type)
2.x views_plugin_cache.inc views_plugin_cache::cache_set($type)

Save data to the cache.

A plugin should override this to provide specialized caching behavior.

1 method overrides views_plugin_cache::cache_set()

File

plugins/views_plugin_cache.inc, line 81

Class

views_plugin_cache
The base plugin to handle caching.

Code

function cache_set($type) {
  switch ($type) {
    case 'query':
      // Not supported currently, but this is certainly where we'd put it.
      break;
    case 'results':
      $data = array(
        'result' => $this->view->result,
        'total_rows' => $this->view->total_rows,
        'pager' => $this->view->pager,
      );
      cache_set($this->get_results_key(), $data, $this->table, $this->cache_set_expire($type));
      break;
    case 'output':
      $this->gather_headers();
      $this->storage['output'] = $this->view->display_handler->output;
      cache_set($this->get_output_key(), $this->storage, $this->table, $this->cache_set_expire($type));
      break;
  }
}