protected function collectGarbage()
 {
     $cache = new PhabricatorKeyValueDatabaseCache();
     $conn_w = $cache->establishConnection('w');
     queryfx($conn_w, 'DELETE FROM %T WHERE cacheExpires < %d
     ORDER BY cacheExpires ASC LIMIT 100', $cache->getTableName(), PhabricatorTime::getNow());
     return $conn_w->getAffectedRows() == 100;
 }
 protected function collectGarbage()
 {
     $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(), $this->getGarbageEpoch());
     return $conn_w->getAffectedRows() == 100;
 }
 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;
 }
 public static final function getOpenSetupIssueKeysFromDatabase()
 {
     $db_cache = new PhabricatorKeyValueDatabaseCache();
     try {
         $value = $db_cache->getKey('phabricator.setup.issue-keys');
         if (!strlen($value)) {
             return null;
         }
         return phutil_json_decode($value);
     } catch (Exception $ex) {
         return null;
     }
 }