summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2007-01-08 17:15:19 +0000
committerxue <>2007-01-08 17:15:19 +0000
commit8448c3d12f47bfc9fad30fb864d8149c7b6bee36 (patch)
tree0a539bd5de28ba5c4fad76eb2e3f7fd34188ff7b
parentb6b0b83ecd63c4f3be594ae6308d4053a494fbb0 (diff)
Added TOutputCache.CachingPostBack
-rw-r--r--framework/Web/UI/WebControls/TOutputCache.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/framework/Web/UI/WebControls/TOutputCache.php b/framework/Web/UI/WebControls/TOutputCache.php
index 5e97a5d9..cb46b2f5 100644
--- a/framework/Web/UI/WebControls/TOutputCache.php
+++ b/framework/Web/UI/WebControls/TOutputCache.php
@@ -83,6 +83,7 @@ class TOutputCache extends TControl implements INamingContainer
private $_varyByParam='';
private $_keyPrefix='';
private $_varyBySession=false;
+ private $_cachePostBack=false;
/**
* Returns a value indicating whether body contents are allowed for this control.
@@ -101,7 +102,7 @@ class TOutputCache extends TControl implements INamingContainer
if(!$this->_cacheChecked)
{
$this->_cacheChecked=true;
- if(!$this->getPage()->getIsPostBack() && $this->_duration>0)
+ if($this->_duration>0 && ($this->_cachePostBack || !$this->getPage()->getIsPostBack()))
{
if($this->_cacheModuleID!=='')
{
@@ -405,6 +406,26 @@ class TOutputCache extends TControl implements INamingContainer
}
/**
+ * @return boolean whether cached output will be used on postback requests. Defaults to false.
+ */
+ public function getCachingPostBack()
+ {
+ return $this->_cachePostBack;
+ }
+
+ /**
+ * Sets a value indicating whether cached output will be used on postback requests.
+ * By default, this is disabled. Be very cautious when enabling it.
+ * If the cached content including interactive user controls such as
+ * TTextBox, TDropDownList, your page may fail to render on postbacks.
+ * @param boolean whether cached output will be used on postback requests.
+ */
+ public function setCachingPostBack($value)
+ {
+ $this->_cachePostBack=TPropertyValue::ensureBoolean($value);
+ }
+
+ /**
* This event is raised when the output cache is checking cache dependency.
* An event handler may be written to check customized dependency conditions.
* The checking result should be saved by setting {@link TOutputCacheCheckDependencyEventParameter::setIsValid IsValid}