@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorCacheTTLGarbageCollector
4 extends PhabricatorGarbageCollector {
5
6 const COLLECTORCONST = 'cache.general.ttl';
7
8 public function getCollectorName() {
9 return pht('General Cache (TTL)');
10 }
11
12 public function hasAutomaticPolicy() {
13 return true;
14 }
15
16 protected function collectGarbage() {
17 $cache = new PhabricatorKeyValueDatabaseCache();
18 $conn_w = $cache->establishConnection('w');
19
20 queryfx(
21 $conn_w,
22 'DELETE FROM %T WHERE cacheExpires < %d
23 ORDER BY cacheExpires ASC LIMIT 100',
24 $cache->getTableName(),
25 PhabricatorTime::getNow());
26
27 return ($conn_w->getAffectedRows() == 100);
28 }
29
30}