summaryrefslogtreecommitdiff
path: root/framework/Caching
diff options
context:
space:
mode:
authorxue <>2006-06-15 14:03:28 +0000
committerxue <>2006-06-15 14:03:28 +0000
commitc8919fa9fc845ab7f3c6701b6de08c8cd042ec30 (patch)
tree080deab47f225b90c2eb35d97ea2724fd58e9d24 /framework/Caching
parent67e09d150afe55d7a956beb299dc0534f7da68eb (diff)
Added TCache.PrimaryCache property.
Added TOutputCache.CacheModuleID property.
Diffstat (limited to 'framework/Caching')
-rw-r--r--framework/Caching/TCache.php30
1 files changed, 28 insertions, 2 deletions
diff --git a/framework/Caching/TCache.php b/framework/Caching/TCache.php
index e369f1df..b1d53525 100644
--- a/framework/Caching/TCache.php
+++ b/framework/Caching/TCache.php
@@ -44,18 +44,44 @@
abstract class TCache extends TModule implements ICache
{
private $_prefix=null;
+ private $_primary=true;
/**
* Initializes the cache module.
* This method initializes the cache key prefix and registers the cache module
- * with the application.
+ * with the application if the cache is primary.
* @param TXmlElement the module configuration
*/
public function init($config)
{
if($this->_prefix===null)
$this->_prefix=$this->getApplication()->getUniqueID();
- $this->getApplication()->setCache($this);
+ if($this->_primary)
+ {
+ if($this->getApplication()->getCache()===null)
+ $this->getApplication()->setCache($this);
+ else
+ throw new TConfigurationException('cache_primary_duplicated',get_class($this));
+ }
+ }
+
+ /**
+ * @return boolean whether this cache module is used as primary/system cache.
+ * A primary cache is used by PRADO core framework to cache data such as
+ * parsed templates, themes, etc.
+ */
+ public function getPrimaryCache()
+ {
+ return $this->_primary;
+ }
+
+ /**
+ * @param boolean whether this cache module is used as primary/system cache. Defaults to false.
+ * @see getPrimaryCache
+ */
+ public function setPrimaryCache($value)
+ {
+ $this->_primary=TPropertyValue::ensureBoolean($value);
}
/**