Tie::Redis::Attribute - Variable attribute based interface to Tie::Redis
version 0.26
use Tie::Redis::Attribute; my %hash : Redis; # %hash now magically resides in a redis instance
This is an experimental module that implements attribute based tying for Redis.
Currently tying of arrays or hashes is supported.
Options may be specified using perl list syntax within the Redis(...) attribute.
Redis(...)
However note that attributes cannot use lexical variables, so my %p : Redis(host = $host)> will unfortunately not work if $host is lexical.
my %p : Redis(host =
$host
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).
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.
server
import
Tie::Redis, Attribute::Tie, Attribute::TieClasses.
David Leadbeater <dgl@dgl.cx>
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.
To install Tie::Redis, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tie::Redis
CPAN shell
perl -MCPAN -e shell install Tie::Redis
For more information on module installation, please visit the detailed CPAN module installation guide.