The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Tie::Redis::Candy - Tie Redis to HashRef or ArrayRef

VERSION

version 0.004

SYNOPSIS

    use Tie::Redis::Candy qw(redis_hash redis_array);
    
    my $redis = Redis->new(...);
    
    my $hashref = redis_hash($redis, $prefix, %initial_values);
    $hashref->{foo} = 'bar';
    
    my $arrayref = redis_array($redis, $listname, @initial_values);
    push @$arrayref => ('foo', 'bar');

DESCRIPTION

This module is inspired by Tie::Redis and Redis::Hash/Redis::List.

FUNCTIONS

redis_hash ($redis, $prefix, %initial_values);

$redis must be an instance of Redis or AnyEvent::Redis. $prefix is optional. With prefix, all keys in the hashref will prefixed with "$prefix:". Set to undef when you want use the entire Redis DB as data source.

redis_array ($redis, $listname, @initial_values);

Behaves similiar to "redis_hash", except that $listname is required.

SERIALIZATION

Serialization is done by CBOR::XS which is fast and light.

EXPORTS

Nothing by default. "redis_hash" and "redis_array" can be exported on request.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/zurborg/libtie-redis-candy-perl/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

David Zurborg <zurborg@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by David Zurborg.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)