FilesystemAdapter
extends AbstractAdapter
in package
implements
PruneableInterface
uses
FilesystemTrait
FinalYes
Table of Contents
Interfaces
- PruneableInterface
Constants
- TTL_ONE_MONTH = 2629743
Methods
- __construct() : mixed
- init() : void
- Sets up the caching folder with the given namespace.
- prefixNamespaceWithVersion() : string
Constants
TTL_ONE_MONTH
private
mixed
TTL_ONE_MONTH
= 2629743
Methods
__construct()
public
__construct([string $namespace = 'phpdoc' ][, int $defaultLifetime = self::TTL_ONE_MONTH ]) : mixed
Parameters
- $namespace : string = 'phpdoc'
- $defaultLifetime : int = self::TTL_ONE_MONTH
init()
Sets up the caching folder with the given namespace.
public
init(string $namespace, string $directory) : void
With phpDocumentor you can set the caching folder in your configuration; this poses an interesting problem with the default FilesystemAdapter of Symfony as that only allows you to set the caching folder upon instantiation.
This method prefixes the namespace with a hash of the current application version. We do this because changes between versions, even minor ones, can cause unexpected issues due to serialization. As a trade-off, we thus force a fresh cache if you use a new/different version of phpDocumentor.
For example:
If a new property is added to a descriptor, upon unserialize PHP will attempt to populate that
with the default property value, or fail if none is provided, but that default may not be the actual result.
Since phpDocumentor runs fast enough for the occasional cache clear, this will have limited impact for end
users and guarantees that the cached state is correct.
Parameters
- $namespace : string
- $directory : string
prefixNamespaceWithVersion()
private
prefixNamespaceWithVersion(string $namespace) : string
Parameters
- $namespace : string