Viktor Turskyi
and 1 contributors

NAME

Hash::Storage - Persistent Hash Storage Framework

SYNOPSIS

    my $st = Hash::Storage->new(
        driver => [ OneFile => { serializer => 'JSON', file => '/tmp/t.json' } ]
    );

    # Store hash by id
    $st->set( 'user1' => { name => 'Viktor', gender => 'M', age => '28' } );

    # Get hash by id
    my $user_data = $st->get('user1');

    # Delete hash by id
    $st->del('user1');

DESCRIPTION

Hash::Storage is a multipurpose storage for hash. You can consider Hash::Storage object as a collection of hashes. You can use it for storing users, sessions and a lot more data.

Hash::Storage has pluggable architecture, therefore you can use different drivers or write you own.

METHODS

Hash::Storage->new(driver => $DRIVER)

$DRIVER is an arrayref with two values: the first is a driver name, the second is a hashref with options for driver.

    my $st = Hash::Storage->new(
        driver => [ OneFile => { serializer => 'JSON', file => '/tmp/t.json' } ]
    );

$DRIVER - also can be a Hash::Storage driver object

    my $drv = Hash::Storage::Driver::OneFile->new({ serializer => 'JSON', file => '/tmp/t.json' });
    my $st = Hash::Storage->new( driver => $drv );

$SELF->set($ID, \%HASH);

Saves hash

$SELF->get($ID);

Retrieves hash

$SELF->del($ID);

Deletes hash

$SELF->list();

returns array with hashrefs

$SELF->count();

returns number of hashes in a collection

AUTHOR

"koorchik", <"koorchik at cpan.org">

BUGS

Please report any bugs or feature requests to bug-hash-storage at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hash-Storage. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Hash::Storage

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012 "koorchik".

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.