Skip to content
Permalink
Browse files

Add a Cache::registry method

  • Loading branch information...
dakota committed Sep 10, 2015
1 parent 8cde613 commit ca6fa484a0139b23ecaaccf949e7b03d24ae67f4
Showing with 24 additions and 0 deletions.
  1. +14 −0 src/Cache/Cache.php
  2. +10 −0 tests/TestCase/Cache/CacheTest.php
@@ -112,6 +112,20 @@ class Cache
*/
protected static $_registry;
/**
* Returns the Cache Registry instance used for creating and using cache adapters.
*
* @return \Cake\Cache\CacheRegistry
*/
public static function registry()
{
if (empty(static::$_registry)) {
static::$_registry = new CacheRegistry();
}
return static::$_registry;
}
/**
* Finds and builds the instance of the required engine class.
*
@@ -559,4 +559,14 @@ public function testRemember()
$result = Cache::remember('test_key', $cacher, 'tests');
$this->assertEquals($expected, $result);
}
/**
* test registry method
*
* @return void
*/
public function testRegistry()
{
$this->assertInstanceOf('\Cake\Cache\CacheRegistry', Cache::registry());
}
}

0 comments on commit ca6fa48

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