OpenPlugin::Cache - Base class for putting data in and getting information out of a cache


OpenPlugin documentation  | view source Contained in the OpenPlugin distribution.

Index


NAME

Top

OpenPlugin::Cache - Base class for putting data in and getting information out of a cache

SYNOPSIS

Top

 use OpenPlugin();
 $OP = OpenPlugin->new();
 my $id = $OP->cache->save( $large_data_set );

 ...

 my $data = $OP->cache->fetch( $id );

DESCRIPTION

Top

This plugin is designed to save data to a cache, and later retrieve that information from that cache. It is very similar to sessions, but data which is cached is meant for all users. Session data is only meant for the user associated with that particular session.

Data you'd typically want to cache includes information returned which requires a lot of time or processing to retrieve. One example is large database queries.

METHODS

Top

fetch( $id )

Retrieves whatever is in the cache tagged by $id.

save( $data, { id = $id, expires => $date })>

Saves data into the cache.

Returns: the cache ID used on success, undef on failure.

Basic parameters -- drivers may define others:

delete( $id )

Delete an existing item from the cache.

Returns true if successful.

BUGS

Top

None known.

TO DO

Top

See the TO DO list in the OpenPlugin::Session plugin.

SEE ALSO

Top

Cache::Cache

COPYRIGHT

Top

AUTHORS

Top

Eric Andreychek <eric@openthought.net>


OpenPlugin documentation  | view source Contained in the OpenPlugin distribution.