\UbillingCache
System-wide caching abstraction engine
Synopsis
class UbillingCache
{
- // constants
- const CACHE_PREFIX = 'UBCACHE_';
- const LOG_PATH = 'exports/cache.log';
- // members
- protected array $altCfg = ;
- protected string $storage = '';
- protected string $memcachedServer = '';
- protected string $memcachedPort = '';
- protected string $redisServer = '';
- protected string $redisPort = '';
- protected string $storagePath = '';
- protected bool $debug = false;
- protected $memcached = '';
- // methods
- public void __construct()
- protected void loadAlter()
- protected void setOptions()
- protected void initStorageServerCache()
- protected string genKey()
- protected void logEvent()
- public void set()
- public mixed get()
- public string getCallback()
- public void delete()
- public array getAllcache()
- public void deleteAllcache()
Constants
Name | Value |
---|---|
CACHE_PREFIX | 'UBCACHE_' |
LOG_PATH | 'exports/cache.log' |
Members
protected
- $altCfg
—
array
System alter.ini config content - $debug
—
bool
Just debugging flag - $memcached
—
Single instance of memcached object - $memcachedPort
—
int
Memcached server port via MEMCACHED_PORT option - $memcachedServer
—
string
Memcached server IP/Hostname via MEMCACHED_SERVER option - $redisPort
—
int
Redis server port via REDIS_PORT option - $redisServer
—
string
Redis server IP/Hostname via REDIS_SERVER option - $storage
—
string
Cache storage type: files, memcached, fake via UBCACHE_STORAGE option - $storagePath
—
string
File storage path: "exports/" by default
Methods
protected
- genKey() — Generates key storable internal name
- initStorageServerCache() — Inits storage server cache if it needed
- loadAlter() — Loads global alter config into protected property
- logEvent() — Logs data if logging is enabled
- setOptions() — Sets object storage mode
public
- __construct() — Creates new UbillingCache instance
- delete() — Deletes data from cache by key name
- deleteAllcache() — Delete all data from cache
- get() — Returns data by key name. Empty if no data exists or cache expired.
- getAllcache() — Show all data from cache
- getCallback() — Returns data from cache by key or runs callback and fills new cache data
- set() — Puts data into cache storage