class views_plugin_cache_time
Same name in other branches
- 7.x-3.x 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 extends \views_object
- class \views_plugin_cache extends \views_plugin
- class \views_plugin_cache_time extends \views_plugin_cache
- class \views_plugin_cache extends \views_plugin
- class \views_plugin extends \views_object
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_definition() {
$options = parent::option_definition();
$options['results_lifespan'] = array(
'default' => 3600,
);
$options['output_lifespan'] = array(
'default' => 3600,
);
return $options;
}
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
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
views_object::$definition | property | Handler's definition | |||
views_object::$options | property | Except for displays, options for the object will be held here. | 1 | ||
views_object::construct | function | Views handlers use a special construct function so that we can more easily construct them with variable arguments. |
6 | ||
views_object::destroy | function | 2 | |||
views_object::export_option | function | 1 | |||
views_object::export_options | function | ||||
views_object::options | function | Set default options on this object. Called by the constructor in a complex chain to deal with backward compatibility. |
1 | ||
views_object::set_default_options | 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::set_definition | function | Let the handler know what its full definition is. | |||
views_object::unpack_options | function | Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. |
|||
views_object::unpack_translatable | function | Unpack a single option definition. | |||
views_object::unpack_translatables | function | Unpacks each handler to store translatable texts. | |||
views_object::_set_option_defaults | function | ||||
views_plugin::$display | property | The current used views display. | |||
views_plugin::$plugin_type | property | The plugin type of this plugin, for example style or query. | |||
views_plugin::$view | property | The top object of a view. | Overrides views_object::$view | 1 | |
views_plugin::additional_theme_functions | function | Provide a list of additional theme functions for the theme information page | |||
views_plugin::options_submit | function | Handle any special handling on the validate form. | 9 | ||
views_plugin::options_validate | function | Validate the options form. | 8 | ||
views_plugin::query | function | Add anything to the query that we might need to. | 7 | ||
views_plugin::theme_functions | function | Provide a full list of possible theme templates used by this style. | |||
views_plugin::validate | function | Validate that the plugin is correct and can be saved. | 2 | ||
views_plugin_cache::$storage | property | Contains all data that should be written/read from cache. | |||
views_plugin_cache::$table | property | What table to store data in. | |||
views_plugin_cache::cache_flush | function | Clear out cached data for a view. | |||
views_plugin_cache::cache_get | function | Retrieve data from the cache. | 1 | ||
views_plugin_cache::cache_set | function | Save data to the cache. | 1 | ||
views_plugin_cache::cache_start | function | Start caching javascript, css and other out of band info. | 1 | ||
views_plugin_cache::gather_headers | function | Gather out of band data, compare it to what we started with and store the difference. | |||
views_plugin_cache::get_output_key | function | ||||
views_plugin_cache::get_results_key | function | ||||
views_plugin_cache::init | function | Initialize the plugin. | |||
views_plugin_cache::post_render | function | Post process any rendered data. | |||
views_plugin_cache::restore_headers | function | Restore out of band data saved to cache. Copied from Panels. | |||
views_plugin_cache_time::cache_expire | function | Determine the expiration time of the cache type, or NULL if no expire. | Overrides views_plugin_cache::cache_expire | ||
views_plugin_cache_time::cache_set_expire | 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::cache_set_expire | ||
views_plugin_cache_time::options_form | function | Provide a form to edit options for this plugin. | Overrides views_plugin::options_form | ||
views_plugin_cache_time::option_definition | function | Information about options for all kinds of purposes will be held here. | Overrides views_object::option_definition | ||
views_plugin_cache_time::summary_title | function | Return a string to display as the clickable title for the access control. |
Overrides views_plugin_cache::summary_title |