lithium\core\Libraries::cache PHP Method

cache() public static method

Returns or sets the the class path cache used for mapping class names to file paths, or locating classes using Libraries::locate().
public static cache ( array $cache = null ) : array
$cache array An array of keys and values to use when pre-populating the cache. Keys are either class names (which match to file paths as values), or dot-separated lookup paths used by `locate()` (which matches to either a single class or an array of classes). If `false`, the cache is cleared.
return array Returns an array of cached class lookups, formatted per the description for `$cache`.
    public static function cache($cache = null)
    {
        if ($cache === false) {
            static::$_cachedPaths = array();
        }
        if (is_array($cache)) {
            static::$_cachedPaths += $cache;
        }
        return static::$_cachedPaths;
    }

Usage Example

Example #1
0
 public function setUp()
 {
     Libraries::cache(false);
     $this->classes = array('response' => 'lithium\\tests\\mocks\\console\\MockResponse');
     $this->_backup['cwd'] = getcwd();
     $this->_backup['_SERVER'] = $_SERVER;
     $_SERVER['argv'] = array();
     chdir(LITHIUM_LIBRARY_PATH . '/lithium');
     $this->request = new Request(array('input' => fopen('php://temp', 'w+')));
     $this->request->params = array('library' => 'build_test');
 }
All Usage Examples Of lithium\core\Libraries::cache