[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/cache/garbagecollector/ -> PhabricatorCacheGeneralGarbageCollector.php (source)

   1  <?php
   2  
   3  final class PhabricatorCacheGeneralGarbageCollector
   4    extends PhabricatorGarbageCollector {
   5  
   6    public function collectGarbage() {
   7      $key = 'gcdaemon.ttl.general-cache';
   8      $ttl = PhabricatorEnv::getEnvConfig($key);
   9      if ($ttl <= 0) {
  10        return false;
  11      }
  12  
  13      $cache = new PhabricatorKeyValueDatabaseCache();
  14      $conn_w = $cache->establishConnection('w');
  15  
  16      queryfx(
  17        $conn_w,
  18        'DELETE FROM %T WHERE cacheCreated < %d
  19          ORDER BY cacheCreated ASC LIMIT 100',
  20        $cache->getTableName(),
  21        time() - $ttl);
  22  
  23      return ($conn_w->getAffectedRows() == 100);
  24    }
  25  
  26  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1