mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-10 13:58:34 +01:00
Summary: This modularizes the rest of the GC submethods. Turned out there was nothing tricky. Test Plan: Ran `bin/phd debug garbage` and got reasonable looking behavior and output. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7971
25 lines
579 B
PHP
25 lines
579 B
PHP
<?php
|
|
|
|
final class DifferentialParseCacheGarbageCollector
|
|
extends PhabricatorGarbageCollector {
|
|
|
|
public function collectGarbage() {
|
|
$key = 'gcdaemon.ttl.differential-parse-cache';
|
|
$ttl = PhabricatorEnv::getEnvConfig($key);
|
|
if ($ttl <= 0) {
|
|
return false;
|
|
}
|
|
|
|
$table = new DifferentialChangeset();
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
queryfx(
|
|
$conn_w,
|
|
'DELETE FROM %T WHERE dateCreated < %d LIMIT 100',
|
|
DifferentialChangeset::TABLE_CACHE,
|
|
time() - $ttl);
|
|
|
|
return ($conn_w->getAffectedRows() == 100);
|
|
}
|
|
|
|
}
|