summaryrefslogtreecommitdiffstats
path: root/lib/private/cache
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@karoshi.org.uk>2015-03-18 16:19:04 +0000
committerRobin McCorkell <rmccorkell@karoshi.org.uk>2015-03-18 16:19:04 +0000
commit693ca9a92ff268ecbd16c7bd7795a177869ea785 (patch)
tree53e41524114770bc0529db8069e383d00be813fc /lib/private/cache
parent42fcd0e8b7bda681069a79be1511a2fe407f09fa (diff)
downloadnextcloud-server-693ca9a92ff268ecbd16c7bd7795a177869ea785.tar.gz
nextcloud-server-693ca9a92ff268ecbd16c7bd7795a177869ea785.zip
Add unit tests for gc() for \OC\Cache\FileGlobalGC
Diffstat (limited to 'lib/private/cache')
-rw-r--r--lib/private/cache/fileglobalgc.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/private/cache/fileglobalgc.php b/lib/private/cache/fileglobalgc.php
index 0bd3f73a5aa..b07e886f652 100644
--- a/lib/private/cache/fileglobalgc.php
+++ b/lib/private/cache/fileglobalgc.php
@@ -6,6 +6,9 @@ use OC\BackgroundJob\Job;
use OCP\IConfig;
class FileGlobalGC extends Job {
+ // only do cleanup every 5 minutes
+ const CLEANUP_TTL_SEC = 300;
+
public function run($argument) {
$this->gc(\OC::$server->getConfig(), $this->getCacheDir());
}
@@ -39,8 +42,7 @@ class FileGlobalGC extends Job {
public function gc(IConfig $config, $cacheDir) {
$lastRun = $config->getAppValue('core', 'global_cache_gc_lastrun', 0);
$now = time();
- if (($now - $lastRun) < 300) {
- // only do cleanup every 5 minutes
+ if (($now - $lastRun) < self::CLEANUP_TTL_SEC) {
return;
}
$config->setAppValue('core', 'global_cache_gc_lastrun', $now);