Name

Object::Relation::Cache - Object::Relation caching

Synopsis

use Object::Relation::Cache;

my $cache = Object::Relation::Cache->new;
$cache->set($id, $object);
$cache->add($id, $object);
$object = $cache->get($id);

Description

This class provides an interface for caching data in Object::Relation, regardless of the underlying caching mechanism chosen.

Methods

new

my $cache = Object::Relation::Cache->new(
    $cache_class,
    $params,
);

Returns a new cache object for whatever caching style was selected by the user.

set

$cache->set($id, $object);

Adds an object to the cache regardless of whether or not that object exists.

add

$cache->add($id, $object);

Adds an object to the cache unless the object exists in the cache. Returns a boolean value indicating success or failure.

get

$cache->get($id);

Gets an object from the cache.

remove

$cache->remove($id);

Removes the corresponding object from the cache.

Copyright and License

Copyright (c) 2004-2006 Kineticode, Inc. <info@obj_relode.com>

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.