Squiz Matrix
4.12.2
|
Public Member Functions | |
Asset_Cache () | |
setSizeRules ($size=-1, $all_items=false) | |
add ($item, $itemid=-1) | |
get ($itemid) | |
release ($itemid) | |
_applySizeRules () | |
remove ($itemid, $force=false) | |
removeAll () | |
getSize ($released=false) | |
getForgottenItemsReport () | |
_trackCaller ($itemid, $rc_diff) | |
getAssetKeys () | |
Public Member Functions inherited from MySource_Object | |
MySource_Object () | |
__sleep () | |
__wakeup () | |
Data Fields | |
$_items = Array() | |
$_items_released = Array() | |
$_size_rules | |
Data Fields inherited from MySource_Object | |
$_tmp | |
Definition at line 42 of file asset_cache.inc.
_applySizeRules | ( | ) |
Applies the size rules, if the current cache size exceeds the rules an item will be removed.
Definition at line 218 of file asset_cache.inc.
_trackCaller | ( | $itemid, | |
$rc_diff | |||
) |
Add information in the cache about the caller class
string | $itemid | id of the item which RC has changed |
int | $rc_diff | difference in the reference count (eg. +1, -1) |
Definition at line 338 of file asset_cache.inc.
add | ( | $item, | |
$itemid = -1 |
|||
) |
Adds an item in the cache Sets the ref count of the item to 1.
object | $item | the item to add |
string | $itemid | the item id (if -1, the id is determined by $item->id) |
Definition at line 119 of file asset_cache.inc.
Asset_Cache | ( | ) |
get | ( | $itemid | ) |
Fetch an item from the cache Returns a reference to this item (null if not found)
string | $itemid | the id of the item to get |
Definition at line 152 of file asset_cache.inc.
getAssetKeys | ( | ) |
Returns all item ids currently loaded in asset cache
Definition at line 374 of file asset_cache.inc.
getForgottenItemsReport | ( | ) |
Returns a information string about all the assets in the cache which Ref Count > 0
Definition at line 301 of file asset_cache.inc.
getSize | ( | $released = false | ) |
Returns the number of items in the cache.
boolean | $released | if true only returns the number of released items if false returns the total number of items |
Definition at line 287 of file asset_cache.inc.
release | ( | $itemid | ) |
Release an item from the cache. Practicaly, it just decreases the RC of the item, if the RC drops to 0 it may be removed from the cache.
string | $itemid | the id of the item to release |
Definition at line 187 of file asset_cache.inc.
remove | ( | $itemid, | |
$force = false |
|||
) |
Remove an item from the cache The item must have a RC = 0
string | $itemid | id of the item to remove |
boolean | $force | if true, the asset is removed even if its RC is > 0, this option shouldn't be used, it is there to remain compatible with the old code. |
Definition at line 248 of file asset_cache.inc.
removeAll | ( | ) |
Remove all released items from the cache
Definition at line 268 of file asset_cache.inc.
setSizeRules | ( | $size = -1 , |
|
$all_items = false |
|||
) |
Sets the size rules
int | $size | maximum allowed number of items if-1,items will never be automatically removed from the cache |
int | $all_items | if true, the rule applies to all the assets in the cache, otherwise it applies only to the released assets. |
Definition at line 100 of file asset_cache.inc.