Locator
in package
Locates the cache folder and ensures that the Symfony Cache is routed to that folder.
Contrary to the way Symfony regularly works, the cache folder can be provided by the configuration and should be set at runtime.
This class plays two roles in this process:
- It exposes a Path that can dynamically change, this will allow other services not to depend on an actual path being passed in their constructor (which is cached by Symfony!) but this service so that their cache actions use the folder that is provided at runtime.
- It will initialize the Symfony Cache pools on runtime
As long as all components that want to cache use this class; then that will ensure that cache is always written to the same location.
Caveat: this class does not change the location of the Symfony 'app' and 'system' cache pools by design; the Symfony internal cache is still stored in folder dictated by Kernel::getCacheDir().
Table of Contents
- $descriptorCache : FilesystemAdapter
- $fileCache : FilesystemAdapter
- $path : Path|null
- __construct() : mixed
- locate() : Path
- providePath() : void
- root() : Path
Properties
$descriptorCache
private
FilesystemAdapter
$descriptorCache
$fileCache
private
FilesystemAdapter
$fileCache
$path
private
Path|null
$path
Methods
__construct()
public
__construct(CacheInterface $files, CacheInterface $descriptors) : mixed
Parameters
- $files : CacheInterface
- $descriptors : CacheInterface
Return values
mixed —locate()
public
locate([string $namespace = '' ]) : Path
Parameters
- $namespace : string = ''
Return values
Path —providePath()
public
providePath(Path $path) : void
Parameters
- $path : Path
Return values
void —root()
private
root() : Path