1.20.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.
File
- modules/
views/ plugins/ views_plugin_cache.inc, line 86 - Definition of views_plugin_cache.
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' => isset($this->view->total_rows) ? $this->view->total_rows : 0,
'current_page' => $this->view->get_current_page(),
);
cache($this->bin)->set($this->get_results_key(), $data, $this->cache_set_expire($type));
break;
case 'output':
$this->gather_headers();
$this->storage['output'] = $this->view->display_handler->output;
cache($this->bin)->set($this->get_output_key(), $this->storage, $this->cache_set_expire($type));
break;
}
}