NAME

Pinwheel::Cache

SYNOPSIS

use Pinwheel::Cache qw(cache cache_get cache_set);

Pinwheel::Cache::set_backend(new Pinwheel::Cache::Hash);

cache_set('key', 'value');
$value = cache_get('get');

cache('key', sub { 'result of complex operation' });

DESCRIPTION

Procedural caching API.

ROUTINES

cache_clear()

Remove all objects from the cache.

cache_get( $key )

Returns the data associated with *$key*.

cache_set( $key, $data, [$expires_in] )

Associates *$data* with *$key* in the cache. *$expires_in* indicates the time in seconds until this data should be erased.

cache_remove( $key )

Delete the data associated with the *$key* from the cache.

cache( $key, [$expires_in], $subroutine )

Call subroutine and store the result in the cache with *$key*. If there is already data in the cache associated with *$key* then it is returned and the subroutine is not called.

set_backend( $backend )

Set the caching backend to use. The backend should implement the Cache::Cache API.

AUTHOR

A&M Network Publishing <DLAMNetPub@bbc.co.uk>