Skip to content

Commit 52512ce

Browse files
committed
Merge pull request #111 from lukeb/final
Fix expiration timer for memcache
2 parents e20c97f + 4860af4 commit 52512ce

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

phpfastcache/3.0.0/drivers/memcache.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ function connectServer() {
6464
function driver_set($keyword, $value = "", $time = 300, $option = array() ) {
6565
$this->connectServer();
6666

67+
// Memcache will only allow a expiration timer less than 2592000 seconds,
68+
// otherwise, it will assume you're giving it a UNIX timestamp.
69+
if($time>2592000) {
70+
$time = time()+$time;
71+
}
72+
6773
if(isset($option['skipExisting']) && $option['skipExisting'] == true) {
6874
return $this->instant->add($keyword, $value, false, $time );
6975

@@ -123,4 +129,4 @@ function driver_isExisting($keyword) {
123129

124130

125131

126-
}
132+
}

0 commit comments

Comments
 (0)