Documentation

SourceCache
in package
implements DefinitionSource, MutableDefinitionSource

Decorator that caches another definition source.

Tags
author

Matthieu Napoli matthieu@mnapoli.fr

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

Methods

addDefinition()

public addDefinition(Definition $definition) : void
Parameters
$definition : Definition

getCacheKey()

public getCacheKey(string $name) : string
Parameters
$name : string
Return values
string

getDefinition()

Returns the DI definition for the entry name.

public getDefinition(string $name) : Definition|null
Parameters
$name : string
Return values
Definition|null

getDefinitions()

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
bool

shouldBeCached()

private shouldBeCached([Definition|null $definition = null ]) : bool
Parameters
$definition : Definition|null = null
Return values
bool

        
On this page

Search results