| [ 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 MMCache Cache 4 * 5 * $Id: MMCache.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: MMCache.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_MMCache 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('mmcache_lock')) { 48 return false; 49 } 50 51 $something = mmcache_get($key); 52 if (is_null($something)){ 53 return false; 54 }else{ 55 return unserialize($something); 56 } 57 } 58 59 /** 60 * write template to cache 61 * 62 * @access public 63 * @param string cache key 64 * @param array templates to store 65 * @return boolean true on success 66 */ 67 function write( $key, $templates ) 68 { 69 if (!function_exists('mmcache_lock')) { 70 return false; 71 } 72 73 mmcache_lock($key); 74 if ($this->getParam( 'lifetime' ) == 'auto'){ 75 mmcache_put($key, serialize( $templates )); 76 }else{ 77 mmcache_put($key, serialize( $templates ), $this->getParam( 'lifetime' ) * 60); 78 } 79 mmcache_unlock($key); 80 81 return true; 82 } 83 } 84 ?>
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 |