CacheCore

Core functionality and default settings shared across caching classes.

Version

2009.10.10

Copyright

2006-2009 LifeNexus Digital, Inc., and contributors.

License

Simplified BSD Licensehttp://opensource.org/licenses/bsd-license.php

See Also

CacheCorehttp://cachecore.googlecode.com
CloudFusionhttp://getcloudfusion.com

CacheCore

Container for all shared caching methods.  This is not intended to be instantiated directly, but is extended by the cache-specific classes.

Properties

name

A name to uniquely identify the cache object by.

location

Where to store the cache.

expires

The number of seconds before a cache object is considered stale.

id

Used internally to uniquely identify the location + name of the cache object.

timestamp

Stores the time when the cache object was created.

gzip

Stores whether or not the content should be gzipped when stored

Functions

__construct()

public function __construct($name,  
$location,  
$expires,  
$gzip =  true)

The constructor

Access

public

Parameters

namestring (Required) A name to uniquely identify the cache object.
locationstring (Required) The location to store the cache object in.  This may vary by cache method.
expiresinteger (Required) The number of seconds until a cache object is considered stale.
gzipboolean (Optional) Whether data should be gzipped before being stored.  Defaults to true.

Returns

object Reference to the cache object.

response_manager()

public function response_manager($callback,  
$params =  null)

Provides a simple, straightforward cache-logic mechanism.  Useful for non-complex response caches.

Access

public

Parameters

callbackstring (Required) The name of the function to fire when we need to fetch new data to cache.
paramsarray (Optional) Parameters to pass into the callback function, as an array.

Returns

array The cached data being requested.