CORE POS - Fannie
The CORE POS back end
Static Public Member Functions | List of all members
COREPOS\Fannie\API\data\DataCache Class Reference
Inheritance diagram for COREPOS\Fannie\API\data\DataCache:
DataCache

Static Public Member Functions

static genKey ()
 
static check ($key=false)
 
static freshen ($data, $ttl='day', $key=false)
 
static getFile ($ttl, $key=false)
 
static putFile ($ttl, $content, $key=false)
 
static fileCacheDir ($type)
 

Detailed Description

Store data for later. This is a more generic caching option based on FannieReportPage. Data is automatically keyed by URL (hint: use GET parameters instead of POST). In theory you can cache any serializable data structure. It's typically used for caching query results.

Member Function Documentation

static COREPOS\Fannie\API\data\DataCache::check (   $key = false)
static

Look for cached data

Data is stored in the archive database, reportDataCache table.

The default key column is an MD5 hash of the current URL (minus the excel parameter, if present). This means your forms should use type GET if caching is enabled. If a key argument is provided, that key is hashed instead.

The data is stored as a serialized, gzcompressed string.

static COREPOS\Fannie\API\data\DataCache::fileCacheDir (   $type)
static

Get filesystem path for storing cache data Auto-creates directories as needed

Parameters
$type[string] monthly or daily
Returns
[string] path or false
static COREPOS\Fannie\API\data\DataCache::freshen (   $data,
  $ttl = 'day',
  $key = false 
)
static

Store data in the cache

Parameters
$datathe data
$ttlhow long data is valid. Options are 'day' and 'month'
$key[optional] custom lookup key
Returns
True or False based on success

See check() for details

static COREPOS\Fannie\API\data\DataCache::genKey ( )
static

Generate default hash value for caching. Uses request URI excluding output formatting options

Returns
md5 string
static COREPOS\Fannie\API\data\DataCache::getFile (   $ttl,
  $key = false 
)
static

Get info from filesystem cache

Parameters
$ttl[string] daily or monthly
$key[optional] use custom key
Returns
cached content or false
static COREPOS\Fannie\API\data\DataCache::putFile (   $ttl,
  $content,
  $key = false 
)
static

Store info to filesystem cache

Parameters
$ttl[string] monthly or daily
$content[string] content to cache
$key[optional] custom key
Returns
[boolean] true or false

The documentation for this class was generated from the following file: