diff --git a/lib/private/Memcache/APCu.php b/lib/private/Memcache/APCu.php index 7f6a73354eed1..9eb2ee0b2bf14 100644 --- a/lib/private/Memcache/APCu.php +++ b/lib/private/Memcache/APCu.php @@ -25,6 +25,9 @@ public function get($key) { } 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 @@ public function clear($prefix = '') { * @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 ba6016c8d283b..cc5a0add61488 100644 --- a/lib/public/ICache.php +++ b/lib/public/ICache.php @@ -15,6 +15,11 @@ * @since 6.0.0 */ interface ICache { + /** + * @since 30.0.0 + */ + const DEFAULT_TTL = 24 * 60 * 60; + /** * Get a value from the user cache * @param string $key