Skip to content

[V5˖] Setup your own namespace

Georges.L edited this page Feb 20, 2020 · 5 revisions

⚠️ Please note that this feature is deprecated as of V7. See here how to override a core driver or setup a custom one.

As of the V5 you can set your own namespace, allowing you by this way to fully override existing drivers:

use phpFastCache\CacheManager;

$yourNamespacePath = 'Somewhere\In\Your\Project';

CacheManager::setNamespacePath($yourNamespacePath);
$itemPool = CacheManager::Files([]);// Will return the following object:

if($itemPool instanceof \Somewhere\In\Your\Project\Files\Driver){
   // This code will return true
}

Please note CacheManager::setNamespacePath() requires to be a fully qualified name to avoid any bug.