SourceCache
in package
implements
DefinitionSource, MutableDefinitionSource
Decorator that caches another definition source.
Tags
Table of Contents
Interfaces
- DefinitionSource
- Source of definitions for entries of the container.
- MutableDefinitionSource
- Describes a definition source to which we can add new definitions.
Constants
- CACHE_KEY = 'php-di.definitions.'
Properties
- $cachedSource : DefinitionSource
- $cacheNamespace : string
Methods
- __construct() : mixed
- addDefinition() : void
- getCacheKey() : string
- getDefinition() : Definition|null
- Returns the DI definition for the entry name.
- getDefinitions() : array<string, Definition>
- Used only for the compilation so we can skip the cache safely.
- isSupported() : bool
- shouldBeCached() : bool
Constants
CACHE_KEY
public
mixed
CACHE_KEY
= 'php-di.definitions.'
Properties
$cachedSource
private
DefinitionSource
$cachedSource
$cacheNamespace
private
string
$cacheNamespace
= ''
Methods
__construct()
public
__construct(DefinitionSource $cachedSource[, string $cacheNamespace = '' ]) : mixed
Parameters
- $cachedSource : DefinitionSource
- $cacheNamespace : string = ''
addDefinition()
public
addDefinition(Definition $definition) : void
Parameters
- $definition : Definition
getCacheKey()
public
getCacheKey(string $name) : string
Parameters
- $name : string
Return values
stringgetDefinition()
Returns the DI definition for the entry name.
public
getDefinition(string $name) : Definition|null
Parameters
- $name : string
Return values
Definition|nullgetDefinitions()
Used only for the compilation so we can skip the cache safely.
public
getDefinitions() : array<string, Definition>
Return values
array<string, Definition> —Definitions indexed by their name.
isSupported()
public
static isSupported() : bool
Return values
boolshouldBeCached()
private
shouldBeCached([Definition|null $definition = null ]) : bool
Parameters
- $definition : Definition|null = null