class apachesolr_views_plugin_cache_time in Apache Solr Views 6
@file provides Views caching plugin for solr
Hierarchy
- class \apachesolr_views_plugin_cache_time extends \views_plugin_cache_time
Expanded class hierarchy of apachesolr_views_plugin_cache_time
1 string reference to 'apachesolr_views_plugin_cache_time'
- apachesolr_views_views_plugins in ./
apachesolr_views.views.inc - Implementation of hook_views_plugins().
File
- plugins/
apachesolr_views_plugin_cache_time.inc, line 6 - provides Views caching plugin for solr
View source
class apachesolr_views_plugin_cache_time extends views_plugin_cache_time {
/**
* Save data to the cache.
*
* A plugin should override this to provide specialized caching behavior.
*/
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,
'response' => apachesolr_static_response_cache(),
);
cache_set($this
->get_results_key(), $data, $this->table);
break;
case 'output':
parent::cache_set($type);
break;
}
}
/**
* Retrieve data from the cache.
*
* A plugin should override this to provide specialized caching behavior.
*/
function cache_get($type) {
$cutoff = $this
->cache_expire($type);
switch ($type) {
case 'query':
// Currently not supported in base class. but we send it up in case it is
return parent::cache_get($type);
case 'results':
// Values to set: $view->result, $view->total_rows, $view->execute_time,
// $view->pager['current_page'].
if ($cache = cache_get($this
->get_results_key(), $this->table)) {
if (!$cutoff || $cache->created > $cutoff) {
$this->view->result = $cache->data['result'];
$this->view->total_rows = $cache->data['total_rows'];
$this->view->pager = $cache->data['pager'];
apachesolr_static_response_cache($cache->data['response']);
apachesolr_current_query($this->view->query);
$this->view->execute_time = 0;
apachesolr_has_searched(TRUE);
return TRUE;
}
}
return FALSE;
case 'output':
return parent::cache_get($type);
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
apachesolr_views_plugin_cache_time:: |
function | Retrieve data from the cache. | ||
apachesolr_views_plugin_cache_time:: |
function | Save data to the cache. |