Badger::Storage::Memory
use Badger::Storage::Memory;
# create a storage object
my $storage = Badger::Storage::Memory->new;
# some sample data
my $data = {
message => 'Hello World!',
numbers => [1.618, 2.718, 3.142],
};
# create a new record
my $id = $storage->create($data);
# fetch data for identifier - returns undef if not found
$data = $storage->fetch($id)
|| die $storage->error;
# insert/update data using identifier
$storage->store($id, $data);
# delete data using identifier
$storage->store($id, $data);
The Badger::Storage::Memory module is a subclass of Badger::Storage for storing data in memory.
The following methods are defined in addition to those inherited from the Badger::Storage, Badger::Prototype and Badger::Base base classes.
Returns the data stored in memory for the index key $id or
undef if no data is defined for it.
Andy Wardley http://wardley.org