summaryrefslogtreecommitdiff
path: root/framework/Data/SqlMap/Configuration
diff options
context:
space:
mode:
authorctrlaltca <>2012-05-29 10:01:36 +0000
committerctrlaltca <>2012-05-29 10:01:36 +0000
commita569b4bf5838fb67c2c453aa2af89f8f220e2337 (patch)
treeee06f210edcf56d619282900939ef4044354710f /framework/Data/SqlMap/Configuration
parent21aa1d7bbcc46d3f76d3d60dd84b5def6905f783 (diff)
committed patch for #407
Diffstat (limited to 'framework/Data/SqlMap/Configuration')
-rw-r--r--framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php
index c70cc48a..e33e8104 100644
--- a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php
+++ b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php
@@ -42,6 +42,13 @@ class TSqlMapCacheModel extends TComponent
private $_properties = array();
private $_flushInterval = 0;
+ private static $_cacheTypes = array();
+
+ public static function registerCacheType($type, $className)
+ {
+ self::$_cacheTypes[$type] = $className;
+ }
+
/**
* @return string unique cache model identifier.
*/
@@ -71,7 +78,10 @@ class TSqlMapCacheModel extends TComponent
*/
public function setImplementation($value)
{
- $this->_implementation = TPropertyValue::ensureEnum($value,'TSqlMapCacheTypes');
+ if (isset(self::$_cacheTypes[$value]))
+ $this->_implementation = $value;
+ else
+ $this->_implementation = TPropertyValue::ensureEnum($value,'TSqlMapCacheTypes');
}
/**
@@ -107,7 +117,10 @@ class TSqlMapCacheModel extends TComponent
*/
public function getImplementationClass()
{
- switch(TPropertyValue::ensureEnum($this->_implementation,'TSqlMapCacheTypes'))
+ $implementation = $this->_implementation;
+ if (isset(self::$_cacheTypes[$implementation])) return self::$_cacheTypes[$implementation];
+
+ switch(TPropertyValue::ensureEnum($implementation,'TSqlMapCacheTypes'))
{
case TSqlMapCacheTypes::FIFO: return 'TSqlMapFifoCache';
case TSqlMapCacheTypes::LRU : return 'TSqlMapLruCache';