class views_plugin_cache_time in Views (for Drupal 7) 6.2
Same name and namespace in other branches
- 6.3 plugins/views_plugin_cache_time.inc \views_plugin_cache_time
- 7.3 plugins/views_plugin_cache_time.inc \views_plugin_cache_time
Simple caching of query results for Views displays.
Hierarchy
- class \views_object
- class \views_plugin
- class \views_plugin_cache
- class \views_plugin_cache_time
- class \views_plugin_cache
- class \views_plugin
Expanded class hierarchy of views_plugin_cache_time
1 string reference to 'views_plugin_cache_time'
- views_views_plugins in includes/
plugins.inc - Implementation of hook_views_plugins
File
- plugins/
views_plugin_cache_time.inc, line 6
View source
class views_plugin_cache_time extends views_plugin_cache {
function option_defaults(&$options) {
$options['results_lifespan'] = 3600;
$options['output_lifespan'] = 3600;
}
function options_form(&$form, &$form_state) {
$options = array(
60,
300,
1800,
3600,
21600,
518400,
);
$options = drupal_map_assoc($options, 'format_interval');
$options = array(
-1 => t('Never cache'),
) + $options;
$form['results_lifespan'] = array(
'#type' => 'select',
'#title' => t('Query results'),
'#description' => t('The length of time raw query results should be cached.'),
'#options' => $options,
'#default_value' => $this->options['results_lifespan'],
);
$form['output_lifespan'] = array(
'#type' => 'select',
'#title' => t('Rendered output'),
'#description' => t('The length of time rendered HTML output should be cached.'),
'#options' => $options,
'#default_value' => $this->options['output_lifespan'],
);
}
function summary_title() {
return format_interval($this->options['results_lifespan'], 1) . '/' . format_interval($this->options['output_lifespan'], 1);
}
function cache_expire($type) {
if ($lifespan = $this->options[$type . '_lifespan']) {
$cutoff = time() - $lifespan;
return $cutoff;
}
else {
return FALSE;
}
}
function cache_set_expire($type) {
if ($lifespan = $this->options[$type . '_lifespan']) {
return time() + $lifespan;
}
else {
return CACHE_PERMANENT;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
views_object:: |
property | Except for displays, options for the object will be held here. | 1 | |
views_object:: |
function | Views handlers use a special construct function so that we can more easily construct them with variable arguments. | 5 | |
views_object:: |
function | 2 | ||
views_object:: |
function | Set default options on this object. Called by the constructor in a complex chain to deal with backward compatibility. | 1 | |
views_object:: |
function | Information about options for all kinds of purposes will be held here. | 9 | |
views_object:: |
function | Set default options. For backward compatibility, it sends the options array; this is a feature that will likely disappear at some point. | ||
views_object:: |
function | Let the handler know what its full definition is. | ||
views_object:: |
function | Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. | ||
views_object:: |
function | 1 | ||
views_plugin:: |
function | Provide a list of additional theme functions for the theme information page | ||
views_plugin:: |
function | Handle any special handling on the validate form. | 3 | |
views_plugin:: |
function | Validate the options form. | 3 | |
views_plugin:: |
function | Add anything to the query that we might need to. | 3 | |
views_plugin:: |
function | Provide a full list of possible theme templates used by this style. | ||
views_plugin:: |
function | Validate that the plugin is correct and can be saved. | 2 | |
views_plugin_cache:: |
property | Contains all data that should be written/read from cache. | ||
views_plugin_cache:: |
property | What table to store data in. | ||
views_plugin_cache:: |
function | Clear out cached data for a view. | ||
views_plugin_cache:: |
function | Retrieve data from the cache. | 1 | |
views_plugin_cache:: |
function | Save data to the cache. | 1 | |
views_plugin_cache:: |
function | Start caching javascript, css and other out of band info. | 1 | |
views_plugin_cache:: |
function | Gather out of band data, compare it to what we started with and store the difference. | ||
views_plugin_cache:: |
function | |||
views_plugin_cache:: |
function | |||
views_plugin_cache:: |
function |
Initialize the plugin. Overrides views_plugin:: |
||
views_plugin_cache:: |
function | Post process any rendered data. | ||
views_plugin_cache:: |
function | Restore out of band data saved to cache. Copied from Panels. | ||
views_plugin_cache_time:: |
function |
Determine the expiration time of the cache type, or NULL if no expire. Overrides views_plugin_cache:: |
||
views_plugin_cache_time:: |
function |
Determine expiration time in the cache table of the cache type
or CACHE_PERMANENT if item shouldn't be removed automatically from cache. Overrides views_plugin_cache:: |
||
views_plugin_cache_time:: |
function |
Provide a form to edit options for this plugin. Overrides views_plugin:: |
||
views_plugin_cache_time:: |
function |
Retrieve the default options when this is a new access
control plugin Overrides views_plugin_cache:: |
||
views_plugin_cache_time:: |
function |
Return a string to display as the clickable title for the
access control. Overrides views_plugin_cache:: |