Cache: ezcCacheStackReplacementStrategy
[ ]
[ ]
[ ]
[ ]
[ ]
Interface: ezcCacheStackReplacementStrategy
|
Interface to be implemented by stack replacement strategies. [
source]
This interface is to be implemented by replacement strategy classes, which can be configured to be used by an
ezcCacheStack. The defined methods wrap around their counterparts on
ezcCacheStackableStorage.
A replacement strategy must take care about the actual storing/restoring/deleting of cache items in the given storage. In addition it must take care about keeping the needed
ezcCacheStackMetaData up to date and about purging data from the cache storage, if it runs full.
Method Summary
|
public static ezcCacheStackMetaData |
createMetaData(
)
Returns a fresh meta data object. |
|
public static array(string) |
delete(
$conf, $metaData, $itemId, [$itemAttributes = array()], [$search = false], $search
)
Deletes the data with the given $itemId from the given $storage. |
|
public static mixed |
restore(
$conf, $metaData, $itemId, [$itemAttributes = array()], [$search = false], $search
)
Restores the data with the given $dataId from the storage given in $conf. |
|
public static void |
store(
$conf, $metaData, $itemId, $itemData, [$itemAttributes = array()] )
Stores the given $itemData in the storage given in $conf. |
Methods
createMetaData
Returns a fresh meta data object.
Different replacement strategies will use different meta data classes. This method must return a freshly created instance of the meta data object used by this meta data.
delete
Deletes the data with the given $itemId from the given $storage.
This method takes care about deleting the item identified by $itemId and optionally $itemAttributes from the
ezcCacheStackableStorage give in $conf. The parameters $itemId, $itemAttributes and $search are therefore forwarded to ezcCacheStackableStorage::delete(). This method returns a list of all item IDs that have been deleted by the call. The method reflects these changes in $metaData.
Parameters
Throws
| Class | Description |
ezcCacheInvalidMetaDataException |
if the given $metaData is not processable by this replacement strategy. |
restore
Restores the data with the given $dataId from the storage given in $conf.
This method takes care of restoring the item with ID $itemId and optionally $itemAttributes from the
ezcCacheStackableStorage given in $conf. The parameters $itemId, $itemAttributes and $search are forwarded to ezcCacheStackableStorage::restore(), the returned value (item data on successful restore, otherwise false) are returned by this method.
The method must take care that the restore process is reflected in $metaData according to the spcific replacement strategy implementation.
Parameters
Throws
| Class | Description |
ezcCacheInvalidMetaDataException |
if the given $metaData is not processable by this replacement strategy. |
store
Stores the given $itemData in the storage given in $conf.
The freeing of items from the storage must first happen via
ezcCacheStackableStorage::purge(), which removes outdated items from the storage and returns the affected IDs. In case this does not last to free the desired number of items, the replacement strategy specific algorithm for freeing takes effect.
After the necessary freeing process has been performed, the item is stored in the storage and the $metaData is updated accordingly.
Parameters
Throws
| Class | Description |
ezcCacheInvalidMetaDataException |
if the given $metaData is not processable by this replacement strategy. |
Last updated: Thu, 08 Jan 2009