Description
Located in File: /FTCache.php
Describes the functions that we will need to implement to provide a mapping between the objects ID and the ID used in the cache.
NOTE: calling fromCache(toCache($some_id)) will not necessarily return $some_id! This is because toCache is used to map both already cached id's and not yet cached ids while fromCache is used to only return the id of already cached entries.
- author: - Justin DeMaris
- abstract: -
Classes extended from FTCache_Strategy:
- FTCache_Strategy_DirectMapping
- Implements a Direct Mapping strategy between the given object id and the cache index id by doing a modulus using the size of the cache.
Method Detail
Summary:
Constructor __construct (line 227)
FTCache_Strategy __construct(
int
$size)
Sets the size of the cache.
Parameters
- int $size: Size of the cache
Info
Method fromCache (line 245)
int fromCache(
int
$index)
Overridden in child classes as:
- FTCache_Strategy_DirectMapping::fromCache()
- Convert a cache entry index into an object id
Convert a cache entry index into an object id
This method must return the object id of the cache entry stored at the given index. If there is nothing stored there, then it must return false.
Parameters
- int $index: Cache entry index
Info
- return - Object Id. False if we can't map that index or nothing is stored there.
- abstract -
- access - public
Method stored (line 253)
void stored(
int
$id)
Overridden in child classes as:
- FTCache_Strategy_DirectMapping::stored()
- Whenever the cache will store an object in the container, it informs this strategy object by calling this method.
Whenever the cache will store an object in the container, it informs this strategy object by calling this method.
Parameters
Info
- abstract -
- access - public
Method toCache (line 264)
int toCache(
int
$id)
Overridden in child classes as:
- FTCache_Strategy_DirectMapping::toCache()
- Convert an object ID into a cache entry index.
Convert an object ID into a cache entry index.
This method must return the index that the given object id is stored at if it is currently stored, or the index that it will be stored at if it is not already stored.
Parameters
Info
- return - Cache Index. False if we can't / won't map that index
- abstract -
- access - public