| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: views_plugin_cache_time.inc,v 1.3 2009/06/30 21:57:22 merlinofchaos Exp $ 3 4 /** 5 * Simple caching of query results for Views displays. 6 */ 7 class views_plugin_cache_time extends views_plugin_cache { 8 function option_defaults(&$options) { 9 $options['results_lifespan'] = 3600; 10 $options['output_lifespan'] = 3600; 11 } 12 13 function options_form(&$form, &$form_state) { 14 $options = array(60, 300, 1800, 3600, 21600, 518400); 15 $options = drupal_map_assoc($options, 'format_interval'); 16 $options = array(-1 => t('Never cache')) + $options; 17 18 $form['results_lifespan'] = array( 19 '#type' => 'select', 20 '#title' => t('Query results'), 21 '#description' => t('The length of time raw query results should be cached.'), 22 '#options' => $options, 23 '#default_value' => $this->options['results_lifespan'], 24 ); 25 $form['output_lifespan'] = array( 26 '#type' => 'select', 27 '#title' => t('Rendered output'), 28 '#description' => t('The length of time rendered HTML output should be cached.'), 29 '#options' => $options, 30 '#default_value' => $this->options['output_lifespan'], 31 ); 32 } 33 34 function summary_title() { 35 return format_interval($this->options['results_lifespan'], 1) . '/' . format_interval($this->options['output_lifespan'], 1); 36 } 37 38 function cache_expire($type) { 39 if ($lifespan = $this->options[$type . '_lifespan']) { 40 $cutoff = time() - $lifespan; 41 return $cutoff; 42 } 43 else { 44 return FALSE; 45 } 46 } 47 48 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |