Documentation

InMemoryStorage extends AbstractStorage
in package

In-memory storage for templates. It never automatically invalidates.

Table of Contents

Properties

$consumer  : mixed
$templates  : array<string|int, AbstractTemplate>
Templates.

Methods

__construct()  : mixed
C'tor.
getConsumer()  : mixed
Getter.
persist()  : void
Persist all templates to storage (e.g. save to filesystem, redis or database).
retrieve()  : array<string|int, AbstractTemplate>|false
Retrieve all templates from storage (e.g. request from filesystem, redis or database).
retrieveBy()  : array<string|int, AbstractTemplate>|false
Get a single template instance by criteria.
shouldInvalidate()  : bool
Check if the storage should be invalidated (e.g. after 24 hours).

Properties

Methods

getConsumer()

Getter.

public getConsumer() : mixed
Tags
codeCoverageIgnore

persist()

Persist all templates to storage (e.g. save to filesystem, redis or database).

public persist(mixed $templates) : void
Parameters
$templates : mixed

retrieve()

Retrieve all templates from storage (e.g. request from filesystem, redis or database).

public retrieve(mixed $forceInvalidate) : array<string|int, AbstractTemplate>|false

Return false if data needs to be retrieved from data sources again.

Parameters
$forceInvalidate : mixed

See ServiceCloudConsumer#retrieveBy parameters

Return values
array<string|int, AbstractTemplate>|false

Return false if the storage does not know about any templates so data sources are used to retrieve data. Afterwards, this is called again.

retrieveBy()

Get a single template instance by criteria.

public retrieveBy(mixed $field, mixed $value, mixed $forceInvalidate) : array<string|int, AbstractTemplate>|false

Predefined $field and $value schemas which you should receive to make it work with all our middlewares:

ResolveServiceTemplatesMiddleware
$field   = `identifier`
$value   = string

VersionsMiddleware
$field   = `versions`
$value   = [string (identifier), ...number]
Parameters
$field : mixed

Can be identifier, or whatever you want to implement to receive templates

$value : mixed
$forceInvalidate : mixed

See ServiceCloudConsumer#retrieveBy parameters

Return values
array<string|int, AbstractTemplate>|false

Return false if the storage does not know about any templates so data sources are used to retrieve data. Afterwards, this is called again.

shouldInvalidate()

Check if the storage should be invalidated (e.g. after 24 hours).

public shouldInvalidate() : bool
Return values
bool

        
On this page

Search results