| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 /** 11 * class lmbFullPageCache. 12 * 13 * @package web_cache 14 * @version $Id: lmbFullPageCache.class.php 5945 2007-06-06 08:31:43Z pachanga $ 15 */ 16 class lmbFullPageCache 17 { 18 protected $policy; 19 protected $cache_writer; 20 protected $session_opened = false; 21 protected $cache_request; 22 23 function __construct($cache_writer, $policy) 24 { 25 $this->cache_writer = $cache_writer; 26 $this->policy = $policy; 27 } 28 29 protected function _isValidSession() 30 { 31 return ($this->session_opened && is_object($this->cache_request)); 32 } 33 34 function get() 35 { 36 if(!$this->_isValidSession()) 37 return false; 38 39 return $this->cache_writer->get($this->_getHash()); 40 } 41 42 function save($content) 43 { 44 if(!$this->_isValidSession()) 45 return false; 46 47 return $this->cache_writer->save($this->_getHash(), $content); 48 } 49 50 protected function _getHash() 51 { 52 return $this->cache_request->getHash(); 53 } 54 55 function openSession($cache_request) 56 { 57 $this->session_opened = false; 58 59 if(!$ruleset = $this->policy->findRuleset($cache_request)) 60 return false; 61 62 if($ruleset->isDeny()) 63 return false; 64 65 $this->session_opened = true; 66 $this->cache_request = $cache_request; 67 68 return true; 69 } 70 71 function flush($hash = null) 72 { 73 if(!$hash) 74 $this->cache_writer->flushAll(); 75 else 76 $this->cache_writer->flush($hash); 77 } 78 } 79 80 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Sep 6 04:46:52 2008 | Cross-referenced by PHPXref 0.7 |