diff options
author | xue <> | 2006-06-15 14:03:28 +0000 |
---|---|---|
committer | xue <> | 2006-06-15 14:03:28 +0000 |
commit | c8919fa9fc845ab7f3c6701b6de08c8cd042ec30 (patch) | |
tree | 080deab47f225b90c2eb35d97ea2724fd58e9d24 /framework/Web | |
parent | 67e09d150afe55d7a956beb299dc0534f7da68eb (diff) |
Added TCache.PrimaryCache property.
Added TOutputCache.CacheModuleID property.
Diffstat (limited to 'framework/Web')
-rw-r--r-- | framework/Web/UI/WebControls/TOutputCache.php | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TOutputCache.php b/framework/Web/UI/WebControls/TOutputCache.php index 76d74b47..b1a7fa93 100644 --- a/framework/Web/UI/WebControls/TOutputCache.php +++ b/framework/Web/UI/WebControls/TOutputCache.php @@ -63,6 +63,7 @@ class TOutputCache extends TControl implements INamingContainer
{
const CACHE_ID_PREFIX='prado:outputcache';
+ private $_cacheModuleID='';
private $_dataCached=false;
private $_cacheAvailable=false;
private $_cacheChecked=false;
@@ -92,12 +93,23 @@ class TOutputCache extends TControl implements INamingContainer if(!$this->_cacheChecked)
{
$this->_cacheChecked=true;
- if(!$this->getPage()->getIsPostBack() && ($this->_cache=$this->getApplication()->getCache())!==null && $this->_duration>0)
+ if(!$this->getPage()->getIsPostBack() && $this->_duration>0)
{
- $this->_cacheAvailable=true;
- $data=$this->_cache->get($this->getCacheKey());
- if(($this->_dataCached=($data!==false)))
- list($this->_contents,$this->_state,$this->_actions)=$data;
+ if($this->_cacheModuleID!=='')
+ {
+ $this->_cache=$this->getApplication()->getModule($this->_cacheModuleID);
+ if(!($this->_cache instanceof ICache))
+ throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID);
+ }
+ else
+ $this->_cache=$this->getApplication()->getCache();
+ if($this->_cache!==null)
+ {
+ $this->_cacheAvailable=true;
+ $data=$this->_cache->get($this->getCacheKey());
+ if(($this->_dataCached=($data!==false)))
+ list($this->_contents,$this->_state,$this->_actions)=$data;
+ }
}
}
}
@@ -272,6 +284,22 @@ class TOutputCache extends TControl implements INamingContainer }
/**
+ * @return string the ID of the cache module. Defaults to '', meaning the primary cache module is used.
+ */
+ public function getCacheModuleID()
+ {
+ return $this->_cacheModuleID;
+ }
+
+ /**
+ * @param string the ID of the cache module. If empty, the primary cache module will be used.
+ */
+ public function setCacheModuleID($value)
+ {
+ $this->_cacheModuleID=$value;
+ }
+
+ /**
* Sets the prefix of the cache key.
* This method is used internally by {@link TTemplate}.
* @param string key prefix
|