\TriTan\CacheCacheAPC

TriTan CMS APC Cache Class.

Summary

Methods
Properties
Constants
read()
create()
delete()
flush()
flushNamespace()
set()
getStats()
increment()
decrement()
__construct()
update()
No public properties found
No constants found
uniqueKey()
exists()
_namespace()
$cache
N/A
No private methods found
No private properties found
N/A

Properties

$cache

$cache : array

Holds the cached objects.

Type

array

Methods

read()

read(integer|string  $key, string  $namespace = 'default') 

Fetches cached data.

Parameters

integer|string $key

Unique key of the APC cached item.

string $namespace

Optional. Where the cache contents are namespaced. Default: 'default'.

create()

create(integer|string  $key, mixed  $data, string  $namespace = 'default', integer  $ttl) 

Creates the APC cache item.

Parameters

integer|string $key

Unique key of the APC cached item.

mixed $data

Data that should be cached.

string $namespace

Optional. Where the cache contents are namespaced. Default: 'default'.

integer $ttl

Time to live sets the life of the APC cached item. Default: 0 = will persist until cleared.

delete()

delete(integer|string  $key, string  $namespace = 'default') 

Deletes cache based on unique key.

Parameters

integer|string $key

Unique key of APC cache.

string $namespace

Optional. Where the cache contents are namespaced. Default: 'default'.

flush()

flush() 

Flushes the APC cache completely.

flushNamespace()

flushNamespace(integer|string  $namespace = 'default') 

Removes all cache items from a particular namespace.

Parameters

integer|string $namespace

Optional. Where the cache contents are namespaced. Default: 'default'.

set()

set(integer|string  $key, mixed  $data, string  $namespace = 'default', integer  $ttl) 

Sets the data contents into the cache.

Parameters

integer|string $key

Unique key of the cache file.

mixed $data

Data that should be cached.

string $namespace

Optional. Where the cache contents are namespaced. Default: 'default'.

integer $ttl

Time to live sets the life of the cache file. Default: 0 = expires immediately after request.

getStats()

getStats() 

Echoes the stats of the cache.

Gives the cache hits, cache misses and cache uptime.

increment()

increment(integer|string  $key, integer  $offset = 1, string  $namespace = 'default') : false|integer

Increments numeric cache item's value.

Parameters

integer|string $key

The cache key to increment

integer $offset

Optional. The amount by which to increment the item's value. Default: 1.

string $namespace

Optional. The namespace the key is in. Default: 'default'.

Returns

false|integer —

False on failure, the item's new value on success.

decrement()

decrement(integer|string  $key, integer  $offset = 1, string  $namespace = 'default') : false|integer

Decrements numeric cache item's value.

Parameters

integer|string $key

The cache key to decrement.

integer $offset

Optional. The amount by which to decrement the item's value. Default: 1.

string $namespace

Optional. The namespace the key is in. Default: 'default'.

Returns

false|integer —

False on failure, the item's new value on success.

__construct()

__construct() 

update()

update(integer|string  $key, mixed  $data, string  $namespace = 'default', integer  $ttl) : boolean

Updates the APC cache based on unique key.

Parameters

integer|string $key

Unique key of the APC cache.

mixed $data

Data that should be cached.

string $namespace

Optional. Where the cache contents are namespaced. Default: 'default'.

integer $ttl

Time to live sets the life of the APC cached item. Default: 0 = will persist until cleared.

Returns

boolean —

False if original value does not exist, true if contents were replaced

uniqueKey()

uniqueKey(integer|string  $key, string  $namespace = 'default') 

Generates a unique cache key.

Parameters

integer|string $key

Unique key for cache file.

string $namespace

Optional. Where the cache contents are namespaced. Default: 'default'.

exists()

exists(integer|string  $key, string  $namespace) : boolean

Serves as a utility method to determine whether a key exists in the cache.

Parameters

integer|string $key

Cache key to check for existence.

string $namespace

Cache namespace for the key existence check.

Returns

boolean —

Whether the key exists in the cache for the given namespace.

_namespace()

_namespace(integer|string  $value) 

Unique namespace for cache item.

{@inheritDoc}

Parameters

integer|string $value

The value to slice to get namespace.