PhabricatorCaches use namespace if set
Summary: PhabricatorCaches now uses namespaced caches if cofig option for cache is set. Test Plan: noidea Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2786 Differential Revision: https://secure.phabricator.com/D5425
This commit is contained in:
committed by
epriestley
parent
004a8de350
commit
9a15f243fa
15
src/applications/cache/PhabricatorCaches.php
vendored
15
src/applications/cache/PhabricatorCaches.php
vendored
@@ -5,6 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
final class PhabricatorCaches {
|
final class PhabricatorCaches {
|
||||||
|
|
||||||
|
public static function getNamespace() {
|
||||||
|
return PhabricatorEnv::getEnvConfig('phabricator.cache-namespace');
|
||||||
|
}
|
||||||
|
|
||||||
/* -( Setup Cache )-------------------------------------------------------- */
|
/* -( Setup Cache )-------------------------------------------------------- */
|
||||||
|
|
||||||
@@ -42,6 +45,12 @@ final class PhabricatorCaches {
|
|||||||
// In most cases, we should have APC. This is an ideal cache for our
|
// In most cases, we should have APC. This is an ideal cache for our
|
||||||
// purposes -- it's fast and empties on server restart.
|
// purposes -- it's fast and empties on server restart.
|
||||||
$apc = new PhutilKeyValueCacheAPC();
|
$apc = new PhutilKeyValueCacheAPC();
|
||||||
|
|
||||||
|
if (PhabricatorCaches::getNamespace()) {
|
||||||
|
$apc = id(new PhutilKeyValueCacheNamespace($apc))
|
||||||
|
->setNamespace(PhabricatorCaches::getNamespace());
|
||||||
|
}
|
||||||
|
|
||||||
if ($apc->isAvailable()) {
|
if ($apc->isAvailable()) {
|
||||||
return array($apc);
|
return array($apc);
|
||||||
}
|
}
|
||||||
@@ -51,6 +60,12 @@ final class PhabricatorCaches {
|
|||||||
$disk_path = self::getSetupCacheDiskCachePath();
|
$disk_path = self::getSetupCacheDiskCachePath();
|
||||||
if ($disk_path) {
|
if ($disk_path) {
|
||||||
$disk = new PhutilKeyValueCacheOnDisk();
|
$disk = new PhutilKeyValueCacheOnDisk();
|
||||||
|
|
||||||
|
if (PhabricatorCaches::getNamespace()) {
|
||||||
|
$disk = id(new PhutilKeyValueCacheNamespace($disk))
|
||||||
|
->setNamespace(PhabricatorCaches::getNamespace());
|
||||||
|
}
|
||||||
|
|
||||||
$disk->setCacheFile($disk_path);
|
$disk->setCacheFile($disk_path);
|
||||||
if ($disk->isAvailable()) {
|
if ($disk->isAvailable()) {
|
||||||
return array($disk);
|
return array($disk);
|
||||||
|
|||||||
@@ -139,7 +139,11 @@ final class PhabricatorCoreConfigOptions
|
|||||||
->setLocked(true)
|
->setLocked(true)
|
||||||
->setDescription(
|
->setDescription(
|
||||||
pht('Custom HTML to show on the main Phabricator dashboard.')),
|
pht('Custom HTML to show on the main Phabricator dashboard.')),
|
||||||
|
$this->newOption('phabricator.cache-namespace', 'string', null)
|
||||||
|
->setLocked(true)
|
||||||
|
->setDescription(pht('Cache namespace.')),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function didValidateOption(
|
protected function didValidateOption(
|
||||||
|
|||||||
Reference in New Issue
Block a user