CacheCore

Core functionality and default settings shared across caching classes.

Version

2008.11.30

Copyright

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

License

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

See Also

Tarzanhttp://tarzan-aws.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.

Functions

__construct()

public function __construct($name,
$location,
$expires)

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.

Returns

object Reference to the cache object.

See Also

Example Usagehttp://tarzan-aws.com/docs/examples/cachecore/cache.phps

create()

public function create($data)

Creates a new cache.  Placeholder method should be defined by the extending class.

Access

public

Parameters

datamixed (Required) The data to cache.

Returns

void

See Also

Example Usagehttp://tarzan-aws.com/docs/examples/cachecore/cache.phps

read()

public function read()

Reads a cache.  Placeholder method should be defined by the extending class.

Access

public

Returns

void

See Also

Example Usagehttp://tarzan-aws.com/docs/examples/cachecore/cache.phps

update()

public function update($data)

Updates an existing cache.  Placeholder method should be defined by the extending class.

Access

public

Parameters

datamixed (Required) The data to cache.

Returns

void

See Also

Example Usagehttp://tarzan-aws.com/docs/examples/cachecore/cache.phps

delete()

public function delete()

Deletes a cache.  Placeholder method should be defined by the extending class.

Access

public

Returns

void

timestamp()

public function timestamp()

Retrieves the timestamp of the cache.  Placeholder method should be defined by the extending class.

Access

public

Returns

void

reset()

public function reset()

Resets the freshness of the cache.  Placeholder method should be defined by the extending class.

Access

public

Returns

void

See Also

Example Usagehttp://tarzan-aws.com/docs/examples/cachecore/cache.phps

is_expired()

public function is_expired()

Checks whether the cache object is expired or not.  Placeholder method should be defined by the extending class.

Access

public

Returns

boolean Whether the cache is expired or not.

See Also

Example Usagehttp://tarzan-aws.com/docs/examples/cachecore/cache.phps

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.

See Also

Example Usagehttp://tarzan-aws.com/docs/examples/cachecore/response_manager.phps