ApiOpenStudio PHPDoc

Cache
in package

Class Cache

Allow storing values in the cache.

Table of Contents

$active  : bool
Cache active status.
$cacheObj  : mixed
Cache object.
$logger  : MonologWrapper
Logging class.
__construct()  : mixed
Constructor.
active()  : bool
Return the status of cache (active or inactive).
clear()  : bool
Clear cache.
get()  : DataContainer|null
Fetch a value from the cache.
getProcessorCacheKey()  : string
Returns the cache key for a processor.
getResourceCacheKey()  : string
Returns the cache key for a resource.
set()  : bool
Store a value in the cache

Properties

$active

Cache active status.

private bool $active

Active status of cache.

$cacheObj

Cache object.

private mixed $cacheObj

Cache object.

Methods

__construct()

Constructor.

public __construct(array<string|int, mixed> $config, MonologWrapper $logger) : mixed
Parameters
$config : array<string|int, mixed>

Api cache config.

$logger : MonologWrapper

Logging object.

Tags
throws
ApiException
Return values
mixed

active()

Return the status of cache (active or inactive).

public active() : bool
Return values
bool

clear()

Clear cache.

public clear() : bool
Tags
throws
ApiException
Return values
bool

get()

Fetch a value from the cache.

public get(string $key[, bool $rawData = false ]) : DataContainer|null
Parameters
$key : string

Get value for a cache key.

$rawData : bool = false

Return raw data or DataContainer.

Tags
throws
ApiException
Return values
DataContainer|null

results on success, null if the key does not exist.

getProcessorCacheKey()

Returns the cache key for a processor.

public getProcessorCacheKey(int $resId, string $processorId) : string
Parameters
$resId : int

Resource ID.

$processorId : string

Processor ID.

Return values
string

getResourceCacheKey()

Returns the cache key for a resource.

public getResourceCacheKey(int $resId) : string
Parameters
$resId : int

Resource ID.

Return values
string

set()

Store a value in the cache

public set(string $key, DataContainer $val, int $ttl) : bool
Parameters
$key : string

Cache key.

$val : DataContainer

Value to store.

$ttl : int

Cache TTL. Time to live (in seconds). 0|-1 = no cache.

Tags
throws
ApiException
Return values
bool

Search results