Skip to content

Commit 939b552

Browse files
committed
Merge pull request #168 from tobsn/patch-1
fixed expiration time
2 parents 704197e + a32a95a commit 939b552

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

phpfastcache/3.0.0/drivers/memcached.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,17 @@ function connectServer() {
7373

7474
function driver_set($keyword, $value = "", $time = 300, $option = array() ) {
7575
$this->connectServer();
76+
77+
// Memcache will only allow a expiration timer less than 2592000 seconds,
78+
// otherwise, it will assume you're giving it a UNIX timestamp.
79+
if($time>2592000) {
80+
$time = time()+$time;
81+
}
82+
7683
if(isset($option['isExisting']) && $option['isExisting'] == true) {
77-
return $this->instant->add($keyword, $value, time() + $time );
84+
return $this->instant->add($keyword, $value, $time);
7885
} else {
79-
return $this->instant->set($keyword, $value, time() + $time );
86+
return $this->instant->set($keyword, $value, $time);
8087

8188
}
8289
}

0 commit comments

Comments
 (0)