APC cache implementation

copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
author Barry O'Donovan

 Methods

Cache constructor.

__construct(int $ttl, string $prefix) : \OSS_SNMP\Cache\Basic

For basic cache, takes no parameters.

Parameters

$ttl

int

Set the default ttl

$prefix

string

Set the default prefix for caching variable names

Returns

\OSS_SNMP\Cache\BasicAn instance of the cache ($this) for fluent interfaces

Clear a named value from the cache

clear(string $var) 

Parameters

$var

string

The name of the value to clear

Clear all values from the cache

clearAll() 

Load a named value from the cache (or null if not present)

load(string $var) : mixed | null

Parameters

$var

string

The name of the value to load

Returns

mixednullThe value from the cache or null

Save a named value to the cache

save(string $var, mixed $val, int $ttl) : mixed

Parameters

$var

string

The name of the value to save

$val

mixed

The value to save

$ttl

int

The time to live of the variable if you want to override the default

Returns

mixedThe value (as passed)

 Properties

 

$_prefix

$_prefix 

 

$_ttl

$_ttl