The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

RedisDB::Parse::Redis - redis protocol parser for RedisDB

SYNOPSIS

    use RedisDB::Parse::Redis;
    my $parser = RedisDB::Parse::Redis->new( redisdb => $ref );
    $parser->add_callback(\&cb);
    $parser->add($data);

DESCRIPTION

This module provides functions to build redis requests and parse replies from the server. Normally you don't want to use this module directly, see RedisDB instead.

METHODS

$class->new(redisdb => $redis, utf8 => $flag)

Creates new parser object. redisdb parameter points to the RedisDB object which owns this parser. The reference will be passed to callbacks as the first argument. utf8 flag may be set if you want all data encoded as UTF-8 before sending to server, and decoded when received.

$class->implementation

Returns name of the package that actually implements parser functionality. It may be either RedisDB::Parse::Redis_PP or RedisDB::Parse::Redis_XS.

$self->build_request($command, @arguments)

Encodes $command and @arguments as redis request.

$self->add_callback(\&cb)

Pushes callback to the queue of callbacks.

$self->set_default_callback(\&cb)

Set callback to invoke when there are no callbacks in queue. Used by subscription loop.

$self->callbacks

Returns true if there are callbacks in queue

$self->propagate_reply($reply)

Invoke every callback from queue and the default callback with the given $reply.

$self->add($data)

Process new data received from the server. For every reply found callback from the queue will be invoked with two parameters -- reference to RedisDB object, and decoded reply from the server.

SEE ALSO

RedisDB

AUTHOR

Pavel Shaydo, <zwon at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2011-2013 Pavel Shaydo.

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.