From ca56ff474f1ca7b7985ea9f2b6717533361e3565 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sun, 17 Apr 2016 16:30:06 +0900 Subject: [PATCH] Automatically convert to relative TTL if Unix timestamp is given --- common/framework/cache.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/framework/cache.php b/common/framework/cache.php index 805f1a1ac..d30f31438 100644 --- a/common/framework/cache.php +++ b/common/framework/cache.php @@ -152,6 +152,10 @@ class Cache { if (self::$_driver !== null) { + if ($ttl >= (3600 * 24 * 30)) + { + $ttl = min(3600 * 24 * 30, max(0, $ttl - time())); + } return self::$_driver->set(self::getRealKey($key, $group_name), $value, intval($ttl)) ? true : false; } else