Class \Scrivo\LocalCache
The LocalCache is the cache that Scrivo uses to store already instantiated objects.
The local cache map through to a persisten cache (if defined). So when an object is not found the local cache the persistent cache will be checked next.
So when you instantiate a Scrivo Page for instance first will be tried to load it from the local cache, if not it is tried to retrieve it from the persistent cache (apc or filecache).
Implements
Defined in:
LocalCache.php.
Attr. | Name / Description |
---|---|
public |
LocalCache($persistentCache) Construct a local cache. |
Attr. | Type | Name | Description |
---|---|---|---|
private static | object[] | $cache | The cache array. |
private static | \..\Cache | $persistentCache | The persitent cache to use. |
Attr. | Type | Name / Description |
---|---|---|
public | boolean |
offsetExists($key) Test if an object exists in the cache. |
public | object |
offsetGet($key) Get an object from the cache. |
public |
offsetSet($key, $value) Set an object in the cache. |
|
public |
offsetUnset($key) Delete an object from the cache. |
Constructor
- public LocalCache(\Scrivo\Cache $persistentCache=null)
-
Construct a local cache.
Parameters:
Type Name Def. Description \Scrivo\Cache $persistentCache null The persistent cache to use behind the local cache.
View source: LocalCache.php line 68.
Members
- private static object[] $cache
-
The cache array.
View source: LocalCache.php line 54.
- private static \Scrivo\Cache $persistentCache
-
The persitent cache to use.
View source: LocalCache.php line 60.
Methods
- public boolean offsetExists(int $key)
-
Test if an object exists in the cache.
Note this is part of the implementation of ArrayAccess and should be invoked as array access:
isset($myLocalCache["key"]);
Parameters:
Type Name Def. Description int $key The key used to store the value.
Returns:
boolean Test if an object exists in the cache.
View source: LocalCache.php line 132.
- public object offsetGet(int $key)
-
Get an object from the cache.
Note this is part of the implementation of ArrayAccess and should be invoked as array access:
$obj = $myLocalCache["key"];
Parameters:
Type Name Def. Description int $key The key used to store the value.
Returns:
object Get an object from the cache.
View source: LocalCache.php line 89.
- public offsetSet(int $key, mixed $value)
-
Set an object in the cache.
Note this is part of the implementation of ArrayAccess and should be invoked as array access:
$myLocalCache["key"] = $obj;
Parameters:
Type Name Def. Description int $key The key used to store the value.
mixed $value The object to set in the cache.
View source: LocalCache.php line 113.
- public offsetUnset(int $key)
-
Delete an object from the cache.
Note this is part of the implementation of ArrayAccess and should be invoked as array access:
usset($myLocalCache["key"]);
Parameters:
Type Name Def. Description int $key The key used to store the value.
View source: LocalCache.php line 155.
Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013