NAME

Tie::Redis - Connect perl data structures to Redis

VERSION

version 0.26

SYNOPSIS

use Tie::Redis;
tie my %r, "Tie::Redis";

$r{foo} = 42;

print $r{foo}; # 42, persistently

DESCRIPTION

This allows basic access to Redis from Perl using tie, so it looks just like a a hash or array.

Please think carefully before using this, the tie interface has quite a performance overhead and the error handling is not that great. Using AnyEvent::Redis or Redis directly is recommended.

General usage

Tie::Redis provides an interface to the top level Redis "hash table"; depending on the type of key you access this then returns a value tied to Tie::Redis::Hash, Tie::Redis::List, Tie::Redis::Scalar or a set type (unfortunately, these aren't yet implemented).

If an error occurs these types will throw an exception, therefore you may want to surround your Redis accessing code with an eval block (or use Try::Tiny).

Issues

There are some cases where Redis and Perl types do not match, for example empty lists in Redis have a type of "none", therefore if you empty a list and then try to access it again it will no longer be an array reference.

Autovivification currently doesn't correctly work, I believe some of this may be fixable but haven't yet fully investigated.

SEE ALSO

AUTHOR

David Leadbeater <dgl@dgl.cx>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by David Leadbeater.

This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Beer-ware license revision 42.