| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?PHP 2 /** 3 * patTemplate Template cache that stores data in the eAccelerator Cache 4 * 5 * $Id: eAccelerator.php 10381 2008-06-01 03:35:53Z pasamio $ 6 * 7 * @package patTemplate 8 * @subpackage Caches 9 * @author Mike Valstar <mikevalstar@thrashcorp.com> 10 */ 11 12 // Check to ensure this file is within the rest of the framework 13 defined('JPATH_BASE') or die(); 14 15 /** 16 * patTemplate Template cache that stores data in the eAccelerator Cache 17 * 18 * If the lifetime is set to auto, the cache files will be kept until 19 * you delete them manually. 20 * 21 * $Id: eAccelerator.php 10381 2008-06-01 03:35:53Z pasamio $ 22 * 23 * @package patTemplate 24 * @subpackage Caches 25 * @author Mike Valstar <mikevalstar@thrashcorp.com> 26 */ 27 class patTemplate_TemplateCache_eAccelerator extends patTemplate_TemplateCache 28 { 29 /** 30 * parameters of the cache 31 * 32 * @access private 33 * @var array 34 */ 35 var $_params = array( 'lifetime' => 'auto'); 36 37 /** 38 * load template from cache 39 * 40 * @access public 41 * @param string cache key 42 * @param integer modification time of original template 43 * @return array|boolean either an array containing the templates or false cache could not be loaded 44 */ 45 function load( $key, $modTime = -1 ) 46 { 47 if (!function_exists('eaccelerator_lock')) { 48 return false; 49 } 50 $something = eaccelerator_get($key); 51 if (is_null($something)){ 52 return false; 53 }else{ 54 return unserialize($something); 55 } 56 } 57 58 /** 59 * write template to cache 60 * 61 * @access public 62 * @param string cache key 63 * @param array templates to store 64 * @return boolean true on success 65 */ 66 function write( $key, $templates ) 67 { 68 if (!function_exists('eaccelerator_lock')) { 69 return false; 70 } 71 72 eaccelerator_lock($key); 73 if ($this->getParam( 'lifetime' ) == 'auto'){ 74 eaccelerator_put($key, serialize( $templates )); 75 }else{ 76 eaccelerator_put($key, serialize( $templates ), $this->getParam( 'lifetime' ) * 60); 77 } 78 eaccelerator_unlock($key); 79 80 return true; 81 } 82 } 83 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |