Class cItemCache.

Implements features to cache entries, usually result sets of Item classes. Contains a list of self instances, where each instance contains cached Items fore one specific table.

 Methods

Adds passed item data to internal cache

addItem(mixed $mId, array $aData) : void

Parameters

$mId

mixed

$aData

array

Usually the recordset

Returns item cache instance, creates it, if not done before.

getInstance(string $sTable, array $aOptions) 
Static

Works as a singleton for one specific table.

Parameters

$sTable

string

Table name

$aOptions

array

Options array as follows: - $aOptions['max_items_to_cache'] = (int) Number of items to cache - $aOptions['enable'] = (bool) Flag to enable caching

Returns existing entry from cache by it's id.

getItem(mixed $mId) : array | null

Parameters

$mId

mixed

Returns

arraynull

Returns existing entry from cache by matching properties and their values.

getItemByProperties(array $aProperties) : array | null

Parameters

$aProperties

array

Assoziative key value pairs

Returns

arraynull

Returns existing entry from cache by matching propery value.

getItemByProperty(mixed $mProperty, mixed $mValue) : array | null

Parameters

$mProperty

mixed

$mValue

mixed

Returns

arraynull

Returns items cache list.

getItemsCache() : array

Returns

array

Removes existing cache entry by it's key

removeItem(mixed $mId) : void

Parameters

$mId

mixed

Removes multiple existing cache entries by their keys

removeItems(array $aIds) : void

Parameters

$aIds

array

Prevent cloning

__clone() 

Contructor of cItemCache

__construct(string $sTable, array $aOptions) 

Parameters

$sTable

string

Table name

$aOptions

array

Options array as follows: - $aOptions['max_items_to_cache'] = (int) Number of items to cache - $aOptions['enable'] = (bool) Flag to enable caching

 Properties

 

$_aItemsCache : array
 

$_bEnable : bool
 

$_iMaxItemsToCache : int
 

$_oInstances : array
 

$_sTable : string