Changeset View
Changeset View
Standalone View
Standalone View
src/applications/cache/spec/PhabricatorDataCacheSpec.php
Show All 28 Lines | final class PhabricatorDataCacheSpec extends PhabricatorCacheSpec { | ||||
} | } | ||||
private function initAPCSpec() { | private function initAPCSpec() { | ||||
$this | $this | ||||
->setName(pht('APC User Cache')) | ->setName(pht('APC User Cache')) | ||||
->setVersion(phpversion('apc')); | ->setVersion(phpversion('apc')); | ||||
if (ini_get('apc.enabled')) { | if (ini_get('apc.enabled')) { | ||||
$this->setIsEnabled(true); | $this | ||||
->setIsEnabled(true) | |||||
->setClearCacheCallback('apc_clear_cache'); | |||||
$this->initAPCCommonSpec(); | $this->initAPCCommonSpec(); | ||||
} else { | } else { | ||||
$this->setIsEnabled(false); | $this->setIsEnabled(false); | ||||
$this->raiseEnableAPCIssue(); | $this->raiseEnableAPCIssue(); | ||||
} | } | ||||
} | } | ||||
private function initAPCuSpec() { | private function initAPCuSpec() { | ||||
$this | $this | ||||
->setName(pht('APCu')) | ->setName(pht('APCu')) | ||||
->setVersion(phpversion('apcu')); | ->setVersion(phpversion('apcu')); | ||||
epriestley: Incorrect / redundant with the call below inside the `ini_get()` clause? | |||||
if (ini_get('apc.enabled')) { | if (ini_get('apc.enabled')) { | ||||
$this->setIsEnabled(true); | $this | ||||
->setIsEnabled(true) | |||||
->setClearCacheCallback('apc_clear_cache'); | |||||
$this->initAPCCommonSpec(); | $this->initAPCCommonSpec(); | ||||
} else { | } else { | ||||
$this->setIsEnabled(false); | $this->setIsEnabled(false); | ||||
$this->raiseEnableAPCIssue(); | $this->raiseEnableAPCIssue(); | ||||
} | } | ||||
} | } | ||||
private function initNoneSpec() { | private function initNoneSpec() { | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | private static function getKeyPattern($key) { | ||||
// TODO: We should probably standardize how digests get embedded into cache | // TODO: We should probably standardize how digests get embedded into cache | ||||
// keys to make this rule more generic. | // keys to make this rule more generic. | ||||
$key = preg_replace('/:celerity:.*$/', ':celerity:X', $key); | $key = preg_replace('/:celerity:.*$/', ':celerity:X', $key); | ||||
$key = preg_replace('/:pkcs8:.*$/', ':pkcs8:X', $key); | $key = preg_replace('/:pkcs8:.*$/', ':pkcs8:X', $key); | ||||
return $key; | return $key; | ||||
} | } | ||||
} | } | ||||
Not Done Inline ActionsThis feels a little redundant (both cache specs implement similar code) and a little fragile (changing human-readable text in pht() generally should not affect program behavior, but it will here). How about this instead? Add these to PhabricatorCacheSpec (or pick some better names if these feel too clunky):
Then, when building the caches, use $this->setClearCacheCallback('apc_clear_cache');, etc., to specify how to clear the cache. epriestley: This feels a little redundant (both cache specs implement similar code) and a little fragile… |
Incorrect / redundant with the call below inside the ini_get() clause?