summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--framework/Caching/TCache.php2
-rw-r--r--framework/Caching/TDbCache.php1
-rw-r--r--framework/Caching/TSqliteCache.php2
4 files changed, 4 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index 5eb35871..1fc3bcca 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,7 @@
Version 3.1.2 To be released
============================
BUG: Ticket#719 - TAutoCompleter should not trigger Validation if CausesValidation=False (Christophe)
+BUG: Ticket#750 - The "expire" parameter is used inconsistently in cache modules (Qiang)
CHG: Changed TConditional so that the controls in its template behave like they are in its parent (Qiang)
CHG: Active Record many-to-many relationship change from self::HAS_MANY to self::MANY_TO_MANY (Wei)
CHG: Active Record no longer automatically performs adding/removing/updating related objects (Qiang)
diff --git a/framework/Caching/TCache.php b/framework/Caching/TCache.php
index e60cecdd..5d0b11a6 100644
--- a/framework/Caching/TCache.php
+++ b/framework/Caching/TCache.php
@@ -147,7 +147,6 @@ abstract class TCache extends TModule implements ICache, ArrayAccess
public function set($id,$value,$expire=0,$dependency=null)
{
$data=array($value,$dependency);
- $expire=($expire<=0)?0:time()+$expire;
return $this->setValue($this->generateUniqueKey($id),serialize($data),$expire);
}
@@ -163,7 +162,6 @@ abstract class TCache extends TModule implements ICache, ArrayAccess
public function add($id,$value,$expire=0,$dependency=null)
{
$data=array($value,$dependency);
- $expire=($expire<=0)?0:time()+$expire;
return $this->addValue($this->generateUniqueKey($id),serialize($data),$expire);
}
diff --git a/framework/Caching/TDbCache.php b/framework/Caching/TDbCache.php
index c71d51ea..4acb2454 100644
--- a/framework/Caching/TDbCache.php
+++ b/framework/Caching/TDbCache.php
@@ -338,6 +338,7 @@ class TDbCache extends TCache
*/
protected function addValue($key,$value,$expire)
{
+ $expire=($expire<=0)?0:time()+$expire;
$sql="INSERT INTO {$this->_cacheTable} (itemkey,value,expire) VALUES(:key,:value,$expire)";
try
{
diff --git a/framework/Caching/TSqliteCache.php b/framework/Caching/TSqliteCache.php
index 1ca45863..076b4fce 100644
--- a/framework/Caching/TSqliteCache.php
+++ b/framework/Caching/TSqliteCache.php
@@ -178,6 +178,7 @@ class TSqliteCache extends TCache
*/
protected function setValue($key,$value,$expire)
{
+ $expire=($expire<=0)?0:time()+$expire;
$sql='REPLACE INTO '.self::CACHE_TABLE.' VALUES(\''.$key.'\',\''.sqlite_escape_string($value).'\','.$expire.')';
return $this->_db->query($sql)!==false;
}
@@ -193,6 +194,7 @@ class TSqliteCache extends TCache
*/
protected function addValue($key,$value,$expire)
{
+ $expire=($expire<=0)?0:time()+$expire;
$sql='INSERT INTO '.self::CACHE_TABLE.' VALUES(\''.$key.'\',\''.sqlite_escape_string($value).'\','.$expire.')';
return @$this->_db->query($sql)!==false;
}