ApiOpenStudio PHPDoc

Cache
in package

Class Cache

Allow storing values in the cache.

Table of Contents

$host  : string
Cache host.
$port  : string
Cache port.
$cacheActive  : bool
Cache active/inactive.
$cacheObj  : mixed
Cache object.
$caches  : array<string|int, mixed>
Current supported caches.
$cacheType  : string
Cache type.
$logger  : MonologWrapper
Logging class.
__construct()  : bool
Constructor.
cacheActive()  : bool
Return the status of cache (active or inactive).
clear()  : false|null
Clear cache.
get()  : mixed
Fetch a value from the cache.
set()  : bool
Store a value in the cache
clearApc()  : bool
Clear the APC cache.
clearMemcache()  : bool
Clear the MmeCache cache.
getApc()  : mixed
Fetch a value from APC
getMemcache()  : mixed
Fetch a value from MemCache
setApc()  : bool
Store a value in APC
setMemcache()  : bool
Store a value in MemCache
setupApc()  : bool
Setup APC, based on params passed in setup()
setupMemcache()  : bool
Setup MemCache, based on params passed in setup()

Properties

$host

Cache host.

public string $host

Cache host.

$port

Cache port.

public string $port

Cache port.

$cacheActive

Cache active/inactive.

private bool $cacheActive

Active status of cache.

$cacheObj

Cache object.

private mixed $cacheObj

Cache object.

$caches

Current supported caches.

private array<string|int, mixed> $caches = ['memcache', 'apc']

Liust of supported caches.

$cacheType

Cache type.

private string $cacheType

Caching to use.

Methods

__construct()

Constructor.

public __construct(array<string|int, mixed> $config, MonologWrapper $logger[, bool $cache = false ]) : bool
Parameters
$config : array<string|int, mixed>

Config array.

$logger : MonologWrapper

Logging object.

$cache : bool = false

Set cache on or off.

False means do not cache. True means select first available caching system. String means select the specified caching system.

Tags
throws
ApiException
Return values
bool

cacheActive()

Return the status of cache (active or inactive).

public cacheActive() : bool
Return values
bool

clear()

Clear cache.

public clear() : false|null
Tags
throws
ApiException
Return values
false|null

get()

Fetch a value from the cache.

public get(string $key) : mixed
Parameters
$key : string

Get value for a cache key.

Return values
mixed

results on success, false on failure

set()

Store a value in the cache

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

Cache key.

$val : mixed

Value to store.

$ttl : int

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

Tags
throws
ApiException
Return values
bool

clearApc()

Clear the APC cache.

private clearApc() : bool
Return values
bool

clearMemcache()

Clear the MmeCache cache.

private clearMemcache() : bool
Return values
bool

getApc()

Fetch a value from APC

private getApc(string $key) : mixed
Parameters
$key : string

APC cache key.

Return values
mixed

getMemcache()

Fetch a value from MemCache

private getMemcache(string $key) : mixed
Parameters
$key : string

Memcache cache key.

Return values
mixed

setApc()

Store a value in APC

private setApc(string $key, mixed $val, int $ttl) : bool
Parameters
$key : string

APC cache key.

$val : mixed

Value to cache.

$ttl : int

TTL.

Return values
bool

setMemcache()

Store a value in MemCache

private setMemcache(string $key, mixed $val, int $ttl) : bool
Parameters
$key : string

Memcache cache key.

$val : mixed

Value to store in Memcache.

$ttl : int

Cache TTL.

Return values
bool

setupApc()

Setup APC, based on params passed in setup()

private setupApc() : bool
Tags
throws
ApiException
Return values
bool

setupMemcache()

Setup MemCache, based on params passed in setup()

private setupMemcache() : bool
Tags
throws
ApiException
Return values
bool

Search results