Cache - notihnio/mgr GitHub Wiki
Currently 3 types of cache are supported. XCache, Memcache and APC
Cache Methods
public set()
Set a key value pair to cache
public get()
Get a value specified by key from cache
public exists()
Checks if value exists in cache
public delete()
Deletes a value from cache
Memcache
Init memcache
$cache = new \Mgr\Cache\Cache("Memcache", cacheTimeToLive, host, port);
cacheTimeToLive is defined as number of seconds (int). If cacheTimeToLive=0 then the cache is persistent
$cache->set("date", date('l jS \of F Y h:i:s A'));
$cache->get("date");
APC
Init APC
$cache = new \Mgr\Cache\Cache("Apc", cacheTimeToLive);
cacheTimeToLive is defined as number of seconds (int). If cacheTimeToLive=0 then the cache is persistent
$cache->set("date", date('l jS \of F Y h:i:s A'));
$cache->get("date");
XCache
Init XCache
$cache = new \Mgr\Cache\Cache("XCache", cacheTimeToLive);
cacheTimeToLive is defined as number of seconds (int). If cacheTimeToLive=0 then the cache is persistent
$cache->set("date", date('l jS \of F Y h:i:s A'));
$cache->get("date");