\CacheService
A simple cache service that uses a configurable CacheStore for persisting items for a given length of time.
Usage
CacheService::inst()->get('mykey');
CacheService::inst()->store('mykey', {someobject}, 3600seconds);
Synopsis
class CacheService
{
- // members
- protected CacheStore $store = NULL;
- public static string $store_type = 'FileBasedCacheStore';
- private integer $expiry = 3600;
- private array $items = ;
- private static $instance;
- // methods
- public static CacheService inst()
- protected void __construct()
- public void configure()
- public void store()
- public void get()
- public void expire()
Members
private
- $expiry
—
int
Cache for 1 hour by default - $instance
- $items
protected
- $store
—
CacheStore
The cache store to use for actually putting and retrieving items from
public
- $store_type
—
string
The type of store we're using for the cache
Methods
public
- configure()
- expire() — Explicitly expire the given key
- get() — Gets a cached value for a given key
- inst() — Get the instance
- store() — Cache an item