class RouterCachingService (View source)

Caching of findMatchResults() and resolve() calls on the web Router.

Properties

protected VariableFrontend $routeCache
protected VariableFrontend $resolveCache
protected PersistenceManagerInterface $persistenceManager
protected LoggerInterface $logger
protected ObjectManagerInterface $objectManager
protected array $routingSettings

Methods

injectLogger(LoggerInterface $logger)

No description

void
initializeObject()

No description

array|bool
getCachedMatchResults(RouteContext $routeContext)

Checks the cache for the given RouteContext and returns the result or false if no matching ache entry was found

void
storeMatchResults(RouteContext $routeContext, array $matchResults, RouteTags $matchedTags = null, RouteLifetime $matchedLifetime = null)

Stores the $matchResults in the cache

getCachedResolvedUriConstraints(ResolveContext $resolveContext)

Checks the cache for the given ResolveContext and returns the cached UriConstraints if a cache entry is found

void
storeResolvedUriConstraints(ResolveContext $resolveContext, UriConstraints $uriConstraints, RouteTags $resolvedTags = null, RouteLifetime $resolvedLifetime = null)

Stores the resolved UriConstraints in the cache together with the $routeValues

array
generateRouteTags(string $uriPath, array $routeValues)

No description

void
flushCaches()

Flushes 'route' and 'resolve' caches.

void
flushCachesByTag(string $tag)

Flushes 'findMatchResults' and 'resolve' caches for the given $tag

void
flushCachesByTags(array $tags)

Flushes 'findMatchResults' and 'resolve' caches for the given $tags

void
flushCachesForUriPath(string $uriPath)

Flushes 'findMatchResults' caches that are tagged with the given $uriPath

bool
containsObject(mixed $subject)

Checks if the given subject contains an object

array
convertObjectsToHashes(array $routeValues)

Recursively converts objects in an array to their identifiers

string
buildResolveCacheIdentifier(ResolveContext $resolveContext, array $routeValues)

Generates the Resolve cache identifier for the given Request

array
extractUuids(array $values)

Helper method to generate tags by taking all UUIDs contained in the given $routeValues or $matchResults

Details

injectLogger(LoggerInterface $logger)

No description

Parameters

LoggerInterface $logger

void initializeObject()

No description

Return Value

void

array|bool getCachedMatchResults(RouteContext $routeContext)

Checks the cache for the given RouteContext and returns the result or false if no matching ache entry was found

Parameters

RouteContext $routeContext

Return Value

array|bool

the cached route values or false if no cache entry was found

void storeMatchResults(RouteContext $routeContext, array $matchResults, RouteTags $matchedTags = null, RouteLifetime $matchedLifetime = null)

Stores the $matchResults in the cache

Parameters

RouteContext $routeContext
array $matchResults
RouteTags $matchedTags
RouteLifetime $matchedLifetime

Return Value

void

UriConstraints|bool getCachedResolvedUriConstraints(ResolveContext $resolveContext)

Checks the cache for the given ResolveContext and returns the cached UriConstraints if a cache entry is found

Parameters

ResolveContext $resolveContext

Return Value

UriConstraints|bool

the cached URI or false if no cache entry was found

void storeResolvedUriConstraints(ResolveContext $resolveContext, UriConstraints $uriConstraints, RouteTags $resolvedTags = null, RouteLifetime $resolvedLifetime = null)

Stores the resolved UriConstraints in the cache together with the $routeValues

Parameters

ResolveContext $resolveContext
UriConstraints $uriConstraints
RouteTags $resolvedTags
RouteLifetime $resolvedLifetime

Return Value

void

protected array generateRouteTags(string $uriPath, array $routeValues)

No description

Parameters

string $uriPath
array $routeValues

Return Value

array

void flushCaches()

Flushes 'route' and 'resolve' caches.

Return Value

void

void flushCachesByTag(string $tag)

Flushes 'findMatchResults' and 'resolve' caches for the given $tag

Parameters

string $tag

Return Value

void

void flushCachesByTags(array $tags)

Flushes 'findMatchResults' and 'resolve' caches for the given $tags

Parameters

array $tags

Return Value

void

void flushCachesForUriPath(string $uriPath)

Flushes 'findMatchResults' caches that are tagged with the given $uriPath

Parameters

string $uriPath

Return Value

void

protected bool containsObject(mixed $subject)

Checks if the given subject contains an object

Parameters

mixed $subject

Return Value

bool

true if $subject contains an object, otherwise false

protected array convertObjectsToHashes(array $routeValues)

Recursively converts objects in an array to their identifiers

Parameters

array $routeValues

the array to be processed

Return Value

array

the modified array or NULL if $routeValues contain an object and its identifier could not be determined

protected string buildResolveCacheIdentifier(ResolveContext $resolveContext, array $routeValues)

Generates the Resolve cache identifier for the given Request

Parameters

ResolveContext $resolveContext
array $routeValues

Return Value

string

protected array extractUuids(array $values)

Helper method to generate tags by taking all UUIDs contained in the given $routeValues or $matchResults

Parameters

array $values

Return Value

array