aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-06-05 23:09:49 +0200
committerBart Visscher <bartv@thisnet.nl>2012-06-05 23:09:49 +0200
commitab788eaa232db0016b759de0eb3e14647f6581be (patch)
tree680d95d41b5c503f434e6d58dfd6cfc23959348a
parent9984c2a5937b38d6bed294c12f58d3a62730c6c8 (diff)
downloadnextcloud-server-ab788eaa232db0016b759de0eb3e14647f6581be.tar.gz
nextcloud-server-ab788eaa232db0016b759de0eb3e14647f6581be.zip
OC_Cache_File ttl=0 indicates forever, but expire in a day to keep the cache clean
-rw-r--r--lib/cache/file.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/cache/file.php b/lib/cache/file.php
index 348389e9ff4..0b7d3e30508 100644
--- a/lib/cache/file.php
+++ b/lib/cache/file.php
@@ -33,6 +33,9 @@ class OC_Cache_File{
public function set($key, $value, $ttl=0) {
$storage = $this->getStorage();
if ($storage and $storage->file_put_contents($key, $value)) {
+ if ($ttl === 0) {
+ $ttl = 86400; // 60*60*24
+ }
return $storage->touch($key, time() + $ttl);
}
return false;
@@ -40,7 +43,7 @@ class OC_Cache_File{
public function hasKey($key) {
$storage = $this->getStorage();
- if ($storage->is_file($key)) {
+ if ($storage && $storage->is_file($key)) {
$mtime = $storage->filemtime($key);
if ($mtime < time()) {
$storage->unlink($key);