Class Contenido_ItemCache.

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.

author Murat Purc
version 0.1.2
copyright four for business AG <www.4fb.de>

 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) 

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

Prevent cloning

__clone() 

Contructor of Contenido_ItemCache

__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

 

Assoziative cache array

$_aItemsCache : array

 

Enable caching

$_bEnable : bool

 

$_iFrame

$_iFrame 

 

Max number of items to cache

$_iMaxItemsToCache : int

 

List of self instances (Contenido_ItemCache)

$_oInstances : array

 

Table name for current instance

$_sTable : string