diff options
-rw-r--r-- | lib/private/Memcache/APCu.php | 6 | ||||
-rw-r--r-- | lib/public/ICache.php | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/private/Memcache/APCu.php b/lib/private/Memcache/APCu.php index 7f6a73354ee..9eb2ee0b2bf 100644 --- a/lib/private/Memcache/APCu.php +++ b/lib/private/Memcache/APCu.php @@ -25,6 +25,9 @@ class APCu extends Cache implements IMemcache { } public function set($key, $value, $ttl = 0) { + if ($ttl === 0) { + $ttl = self::DEFAULT_TTL; + } return apcu_store($this->getPrefix() . $key, $value, $ttl); } @@ -56,6 +59,9 @@ class APCu extends Cache implements IMemcache { * @return bool */ public function add($key, $value, $ttl = 0) { + if ($ttl === 0) { + $ttl = self::DEFAULT_TTL; + } return apcu_add($this->getPrefix() . $key, $value, $ttl); } diff --git a/lib/public/ICache.php b/lib/public/ICache.php index ba6016c8d28..5e755d81e14 100644 --- a/lib/public/ICache.php +++ b/lib/public/ICache.php @@ -16,6 +16,11 @@ namespace OCP; */ interface ICache { /** + * @since 30.0.0 + */ + public const DEFAULT_TTL = 24 * 60 * 60; + + /** * Get a value from the user cache * @param string $key * @return mixed |