$context
$context : object
Context object.
TriTan CMS Cookie Cache Class.
create(integer|string $key, mixed $data, string $namespace = 'default', integer $ttl)
Creates the cache file.
integer|string | $key | Unique key of the cache file. |
mixed | $data | Data that should be cached. |
string | $namespace | Optional. Where to namespace the cache contents. Default: 'default'. |
integer | $ttl | Time to live sets the life of the cache file. Default: 0 = expires immediately after request. |
delete(integer|string $key, string $namespace = 'default') : boolean
Deletes a cache file based on unique key.
integer|string | $key | Unique key of cache file. |
string | $namespace | Optional. Where to namespace the cache contents. Default: 'default'. |
Returns true if the cache was deleted or false otherwise.
flushNamespace(integer|string $namespace = 'default') : boolean
Removes all cache items from a particular namespace.
integer|string | $namespace | Optional. Where the cache contents are namespaced. Default: 'default'. |
Returns true if the namespace was purged or false otherwise.
set(integer|string $key, mixed $data, string $namespace = 'default', integer $ttl) : boolean
Sets the data contents into the cache.
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. |
Returns true if the cache was set and false otherwise.
increment(integer|string $key, integer $offset = 1, string $namespace = 'default') : false|integer
Increments numeric cache item's value.
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'. |
False on failure, the item's new value on success.
decrement(integer|string $key, integer $offset = 1, string $namespace = 'default') : false|integer
Decrements numeric cache item's value.
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'. |
False on failure, the item's new value on success.
__construct(\TriTan\Interfaces\ContextInterface $context)
\TriTan\Interfaces\ContextInterface | $context |
update(integer|string $key, mixed $data, string $namespace = 'default', integer $ttl) : boolean
Updates a cache file based on unique ID.
This method only exists for CRUD completeness purposes and just basically calls the create method.
integer|string | $key | Unique key of the cache file. |
mixed | $data | Data that should be cached. |
string | $namespace | Optional. Where to namespace the cache contents. Default: 'default'. |
integer | $ttl | Time to live sets the life of the cache file. Default: no expiration. |
False if original value does not exist, true if contents were replaced
exists(integer|string $key, string $namespace) : boolean
Serves as a utility method to determine whether a key exists in the cache.
integer|string | $key | Cache key to check for existence. |
string | $namespace | Cache namespace for the key existence check. |
Whether the cache item exists in the cache for the given key and namespace.
removeStaleCache(integer|string $key, integer|string $namespace = 'default', integer $ttl)
Removes any and all stale items from the cache.
integer|string | $key | Unqiue key of cache. |
integer|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. |