diff options
Diffstat (limited to 'framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php')
-rw-r--r-- | framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php index 5d19a3a3..aa688b05 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php @@ -38,8 +38,9 @@ class TSqlMapCacheModel extends TComponent private $_hits = 0;
private $_requests = 0;
private $_id;
- private $_implementation='basic';
+ private $_implementation=TSqlMapCacheTypes::Basic;
private $_properties = array();
+ private $_flushInterval = 0;
/**
* @return string unique cache model identifier.
@@ -74,6 +75,23 @@ class TSqlMapCacheModel extends TComponent }
/**
+ * integer the number of seconds in which the cached value will expire. 0 means never expire.
+ * @param int cache size.
+ */
+ public function setFlushInterval($value)
+ {
+ $this->_flushInterval=TPropertyValue::ensureInteger($value);
+ }
+
+ /**
+ * @return int cache duration.
+ */
+ public function getFlushInterval()
+ {
+ return $this->_flushInterval;
+ }
+
+ /**
* Initialize the cache implementation, sets the actual cache contain if supplied.
* @param ISqLMapCache cache implementation instance.
*/
@@ -142,7 +160,7 @@ class TSqlMapCacheModel extends TComponent $key = $key->getHash();
if($value!==null)
- $this->_cache->set($key, $value);
+ $this->_cache->set($key, $value, $this->_flushInterval);
}
/**
|