NAME

Tie::Redis::Attribute - Variable attribute based interface to Tie::Redis

VERSION

version 0.26

SYNOPSIS

use Tie::Redis::Attribute;

my %hash : Redis; # %hash now magically resides in a redis instance

DESCRIPTION

This is an experimental module that implements attribute based tying for Redis.

Currently tying of arrays or hashes is supported.

OPTIONS

Options may be specified using perl list syntax within the Redis(...) attribute.

However note that attributes cannot use lexical variables, so my %p : Redis(host = $host)> will unfortunately not work if $host is lexical.

  • key

    The key to use, if this isn't provided a key is invented based on the package name and variable name. This means for some simple purposes you may not need to specify a key.

    For example:

    our @queue : Redis(key => "my-queue");

Other options are as per Tie::Redis's constructor (prefix) and AnyEvent::Redis (host, port, encoding).

METHODS

server

You may subclass this and define a server method that returns an instance of Tie::Redis. Due to the tricky nature of attributes it is recommended to not define an import method in your subclass other than the one provided by this class.

SEE ALSO

Tie::Redis, Attribute::Tie, Attribute::TieClasses.

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.