Skip to content
Permalink
Browse files

Allow for injecting of a cache registry

  • Loading branch information...
dakota committed Sep 11, 2015
1 parent 313318a commit 219c87228f6a807d945d9c630f81b6184c316a22
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/Cache/Cache.php
@@ -15,6 +15,7 @@
namespace Cake\Cache;
use Cake\Cache\Engine\NullEngine;
use Cake\Core\ObjectRegistry;
use Cake\Core\StaticConfigTrait;
use InvalidArgumentException;
use RuntimeException;
@@ -114,11 +115,17 @@ class Cache
/**
* Returns the Cache Registry instance used for creating and using cache adapters.
* Also allows for injecting of a new registry instance.
*
* @param \Cake\Core\ObjectRegistry $registry Injectable registry object.
* @return \Cake\Cache\CacheRegistry
*/
public static function registry()
public static function registry(ObjectRegistry $registry = null)
{
if ($registry) {
static::$_registry = $registry;
}
if (empty(static::$_registry)) {
static::$_registry = new CacheRegistry();
}

0 comments on commit 219c872

Please sign in to comment.
You can’t perform that action at this time.