Documentation

StorageHelper
in package
Uses UtilsProvider

Helper functionality for common storage operations for a given consumer.

Table of Contents

Constants

TABLE_NAME  = 'template'
TRANSIENT_CACHE_EXPIRE  = 24 * 60 * 60
TRANSIENT_CACHE_KEY  = RCB_OPT_PREFIX . '-%s-templates-%s'
TYPE_BLOCKER  = 'blocker'
TYPE_SERVICE  = 'service'

Properties

$expireOption  : ExpireOption
Cache of templates as they can be time-consuming to generate.
$storage  : mixed

Methods

__construct()  : mixed
C'tor.
fromArray()  : mixed
Convert JSON to `ServiceTemplate` or `BlockerTemplate` depending on current type.
getCacheInvalidateKey()  : mixed
Automatically invalidate storage when Real Cookie Banner verion changes.
getContext()  : string
Get context from variable resolver.
getExpireOption()  : mixed
Get the `ExpireOption` instance.
getPluginConstantPrefix()  : string
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
getType()  : mixed
Get type as string from template type class.
persist()  : mixed
Persist a set of templates in chunks into the database.
retrieveBy()  : array<string|int, AbstractTemplate>|false
Retrieve all templates (`field=null`) or by criteria.
shouldInvalidate()  : mixed
updateOutdated()  : mixed
Update all `is_outdated` for all known services.

Constants

TRANSIENT_CACHE_EXPIRE

public mixed TRANSIENT_CACHE_EXPIRE = 24 * 60 * 60

TRANSIENT_CACHE_KEY

public mixed TRANSIENT_CACHE_KEY = RCB_OPT_PREFIX . '-%s-templates-%s'

Properties

$expireOption

Cache of templates as they can be time-consuming to generate.

private ExpireOption $expireOption

So, they are recalculated each x hours.

Methods

fromArray()

Convert JSON to `ServiceTemplate` or `BlockerTemplate` depending on current type.

public fromArray(array<string|int, mixed> $array) : mixed
Parameters
$array : array<string|int, mixed>

getCacheInvalidateKey()

Automatically invalidate storage when Real Cookie Banner verion changes.

public getCacheInvalidateKey() : mixed

getContext()

Get context from variable resolver.

public getContext() : string
Return values
string

getExpireOption()

Get the `ExpireOption` instance.

public getExpireOption() : mixed

getPluginConstantPrefix()

Get the prefix of this plugin so composer packages can dynamically build other constant values on it.

public getPluginConstantPrefix() : string
Tags
codeCoverageIgnore

It only returns a string with the constant prefix

Return values
string

getType()

Get type as string from template type class.

public getType() : mixed

persist()

Persist a set of templates in chunks into the database.

public persist(array<string|int, AbstractTemplate$templates[, closre $otherMetaKeysResolver = null ]) : mixed
Parameters
$templates : array<string|int, AbstractTemplate>
$otherMetaKeysResolver : closre = null

retrieveBy()

Retrieve all templates (`field=null`) or by criteria.

public retrieveBy([string $field = null ][, mixed $value = null ][, string $middlewareRoutine = 'after' ][, bool|string $forceInvalidate = false ]) : array<string|int, AbstractTemplate>|false
Parameters
$field : string = null
$value : mixed = null
$middlewareRoutine : string = 'after'

Can be before or after

$forceInvalidate : bool|string = false
Return values
array<string|int, AbstractTemplate>|false

updateOutdated()

Update all `is_outdated` for all known services.

public updateOutdated() : mixed

        
On this page

Search results