Page MenuHomePhabricator

D16993.id40884.diff
No OneTemporary

D16993.id40884.diff

diff --git a/src/applications/cache/PhabricatorCaches.php b/src/applications/cache/PhabricatorCaches.php
--- a/src/applications/cache/PhabricatorCaches.php
+++ b/src/applications/cache/PhabricatorCaches.php
@@ -117,6 +117,42 @@
}
+/* -( Runtime Cache )------------------------------------------------------ */
+
+
+ /**
+ * Get a runtime cache stack.
+ *
+ * This stack is just APC. It's fast, it's effectively immutable, and it
+ * gets thrown away when the webserver restarts.
+ *
+ * This cache is suitable for deriving runtime cache, like a map of Conduit
+ * method names to provider classes.
+ *
+ * @return PhutilKeyValueCacheStack Best runtime stack available.
+ */
+ public static function getRuntimeCache() {
+ static $cache;
+ if (!$cache) {
+ $caches = self::buildRuntimeCaches();
+ $cache = self::newStackFromCaches($caches);
+ }
+ return $cache;
+ }
+
+
+ private static function buildRuntimeCaches() {
+ $caches = array();
+
+ $apc = new PhutilAPCKeyValueCache();
+ if ($apc->isAvailable()) {
+ $caches[] = $apc;
+ }
+
+ return $caches;
+ }
+
+
/* -( Repository Graph Cache )--------------------------------------------- */

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 7, 4:44 AM (16 h, 30 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7319963
Default Alt Text
D16993.id40884.diff (1 KB)

Event Timeline