$cache
$cache : object
Cache object.
TriTan CMS Object Cache Class
__construct(\TriTan\Interfaces\Cache\CacheInterface $cache)
\TriTan\Interfaces\Cache\CacheInterface | $cache |
create(integer|string $key, mixed $data, string $namespace = 'default', integer $expire = 3600) : boolean
Adds data to the cache, if the cache key doesn't already exist.
integer|string | $key | The cache key to use for retrieval later. |
mixed | $data | The data to add to the cache. |
string | $namespace | Optional. Where the cache contents are namespaced. |
integer | $expire | Optional. When the cache data should expire, in seconds. Default: 3600 seconds = 1 hour / 60 minutes. |
False if cache key already exists, true on success.
read(integer|string $key, string $namespace = 'default') : boolean|mixed
Retrieves the cache contents from the cache by key and group.
integer|string | $key | The key under which the cache contents are stored. |
string | $namespace | Optional. Where the cache contents are namespaced. |
False on failure to retrieve contents or the cache contents on success.
update(integer|string $key, mixed $data, string $namespace = 'default', integer $expire = 3600) : boolean
Replaces the contents of the cache with new data.
integer|string | $key | The key for the cache data that should be replaced. |
mixed | $data | The new data to store in the cache. |
string | $namespace | Optional. Where the cache contents are namespaced. |
integer | $expire | Optional. When to expire the cache contents, in seconds. Default: 3600 seconds = 1 hour / 60 minutes. |
False if original value does not exist, true if contents were replaced
delete(integer|string $key, string $namespace = 'default') : boolean
Removes the cache contents matching key and group.
integer|string | $key | What the contents in the cache are called. |
string | $namespace | Optional. Where the cache contents are namespaced. |
True on successful removal, false on failure.
set(integer|string $key, mixed $data, string $namespace = '', integer $expire = 3600) : 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 | $expire | Optional. When to expire the cache contents, in seconds. Default: 3600 seconds = 1 hour / 60 minutes. |
Returns true if the cache was set and false otherwise.
increment(integer|string $key, integer $offset = 1, string $namespace = '') : 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. |
False on failure, the item's new value on success.
decrement(integer|string $key, integer $offset = 1, string $namespace = '') : 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. |
False on failure, the item's new value on success.