@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 PhabricatorCacheGeneralGarbageCollector
4 extends PhabricatorGarbageCollector {
5
6 const COLLECTORCONST = 'cache.general';
7
8 public function getCollectorName() {
9 return pht('General Cache');
10 }
11
12 public function getDefaultRetentionPolicy() {
13 return phutil_units('30 days in seconds');
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 cacheCreated < %d
23 ORDER BY cacheCreated ASC LIMIT 100',
24 $cache->getTableName(),
25 $this->getGarbageEpoch());
26
27 return ($conn_w->getAffectedRows() == 100);
28 }
29
30}