function views_plugin_cache::cache_set

Save data to the cache.

A plugin should override this to provide specialized caching behavior.

1 call to views_plugin_cache::cache_set()
views_plugin_cache_time::cache_set in plugins/views_plugin_cache_time.inc
Save data to the cache.
2 methods override views_plugin_cache::cache_set()
views_plugin_cache_none::cache_set in plugins/views_plugin_cache_none.inc
Save data to the cache.
views_plugin_cache_time::cache_set in plugins/views_plugin_cache_time.inc
Save data to the cache.

File

plugins/views_plugin_cache.inc, line 88

Class

views_plugin_cache
The base plugin to handle caching.

Code

public 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_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;
    }
}