+ /**
+ * EXPERIMENTAL. Retrieve a named cache instance.
+ *
+ * This interface is flagged as experimental due to political
+ * ambiguity in PHP community -- PHP-FIG has an open but
+ * somewhat controversial draft standard for caching. Based on
+ * the current draft, it's expected that this function could
+ * simultaneously support both CRM_Utils_Cache_Interface and
+ * PSR-6, but that depends on whether PSR-6 changes any more.
+ *
+ * @param string $name
+ * The name of the cache. The 'default' cache is biased toward
+ * high-performance caches (eg memcache/redis/apc) when
+ * available and falls back to single-request (static) caching.
+ * @return CRM_Utils_Cache_Interface
+ */
+ public static function cache($name = 'default') {
+ return \Civi\Core\Container::singleton()->get('cache.' . $name);
+ }
+