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.


Constructor summary

Attr. Name / Description
public

LocalCache($persistentCache)

Construct a local cache.

Member summary

Attr. Type Name Description
private static object[] $cache The cache array.
private static \..\Cache $persistentCache The persitent cache to use.

Method summary

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.


Members


				
private static object[] $cache

The cache array.


				
private static \Scrivo\Cache $persistentCache

The persitent cache to use.


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.

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.

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.

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.


Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013