Page MenuHomec4science

PhabricatorCacheGeneralGarbageCollector.php
No OneTemporary

File Metadata

Created
Mon, Nov 4, 10:26

PhabricatorCacheGeneralGarbageCollector.php

<?php
final class PhabricatorCacheGeneralGarbageCollector
extends PhabricatorGarbageCollector {
public function collectGarbage() {
$key = 'gcdaemon.ttl.general-cache';
$ttl = PhabricatorEnv::getEnvConfig($key);
if ($ttl <= 0) {
return false;
}
$cache = new PhabricatorKeyValueDatabaseCache();
$conn_w = $cache->establishConnection('w');
queryfx(
$conn_w,
'DELETE FROM %T WHERE cacheCreated < %d
ORDER BY cacheCreated ASC LIMIT 100',
$cache->getTableName(),
time() - $ttl);
return ($conn_w->getAffectedRows() == 100);
}
}

Event Timeline