NAME
    ReRe - Simple Redis Rest Interface

VERSION
    version 0.021

SYNOPSIS
  Console
        # authentication by ip address.
        curl -L http://127.0.0.1:3000/redis/set/foo/bar
        {"set":{"foo":"bar"}}

        curl -L http://127.0.0.1:3000/redis/get/foo
        {"get":{"foo":"bar"}}

        curl -L http://127.0.0.1:3000/redis/info
        {"info":{"last_save_time":"1306939038", ... }}

        # authentication by http basic.
        curl --basic -u 'userro:userro' -L http://127.0.0.1:3000/redis/get/foo
        {"get":{"foo":"bar"}}

        # JSONP Callback.
        curl --basic -u 'userro:userro' -L
        http://127.0.0.1:3000/redis/get/foo\?callback=MyCB
        MyCB( {"get":{"foo":"bar"}} )

  Perl
        use ReRe::Client;
        my $conn = ReRe::Client->new(
            {   url      => '127.0.0.1:3000',
                username => 'userro',
                password => 'userro'
            } );

        $conn->set( 'foo', '2' );

        $conn->get('foo')

    See ReRe::Client for more information.

DESCRIPTION
    ReRe is a simple redis rest interface write in Perl and Mojolicious,
    with some features like:

  What is ReRe ?
    Access your Redis database directly from Javascript.
    Allows you to plugin other technologies: caching via varnish, proxying
    via HAProxy, authentication for APIs, etc. because HTTP is well
    supported.
    Access control list for methods of redis ;
    Support to run as daemon (simple web-server), CGI, FastCGI or PSGI ;
    HTTP Basic Auth security
    Support for GET and POST.
    Support for JSONP.
    HTTP 1.1 pipelining (fastcgi and psgi)
    CIDR authentication
    Bad support for Websockets
    Hooking, you can alter the behavior of an request method.
    ReRe::Client for write client applications in Perl.
    REST interface to make your life easy in some world ;
    Simple to install and use

  What is not ReRe ?
    Please, don't use this application if ...

    If you are looking for a local database for cache or key-value
    If you are looking for performance.

Configuration
  users.conf
        <users>
            <userro>
                password userro
                roles get
            </userro>

            <userrw>
                password userrw
                roles get set info
            </userrw>

            <userall>
                allow 127.0.0.1
                password userall
                roles all
            </userall>

            <userlocalnet>
                allow 192.168.0.0/24
                roles get info
            </userlocalnet>
        </users>

  server.conf
        <server>
            host 127.0.0.1
            port 6379
            hooks Log
        </server>

Hooks
    You can alter the behaivor of any method or create your own.

  Example
        package ReRe::Hook::MyHook;
        use Moose::Role;

        sub _hook {
            my $self = shift;

            my $method = $self->method;
            my $args = $self->args;
            my $conn = $self->conn;

            if ( $method eq 'set' ) {
                my ( $key, $value ) = @{$args};

                if ( $key eq 'immutable' ) {
                    return { err => 'this object is immutable' }
                }

                if ( $key eq 'semaphoro' ) {
                    my $new_value = 0;
                    $new_value = 1 if $value eq 'red';
                    return $self->conn->set($key, $new_value)
                }
            }

        return 0; # if you want to process the origin method.
        }

        1;

Documentation
    More information, you can read in <http://www.rere.com.br>.

Development
    ReRe is a open source project for everyone to participate. The code
    repository is located on github. Feel free to send a bug report, a pull
    request, or a beer.

    <http://www.github.com/maluco/ReRe>

METHODS
  start
    Start ReRe.

  process
    Process the request to redis server.

SUPPORT
    You can find documentation for this module with the perldoc command.

    perldoc ReRe perldoc ReRe::Config perldoc ReRe::Server perldoc
    ReRe::User

    You can also look for information at:

    *   RT: CPAN's request tracker

        <http://rt.cpan.org/NoAuth/Bugs.html?Dist=ReRe>

    *   AnnoCPAN: Annotated CPAN documentation

        <http://annocpan.org/dist/ReRe>

    *   CPAN Ratings

        <http://cpanratings.perl.org/d/ReRe>

    *   Search CPAN

        <http://search.cpan.org/dist/ReRe>

AUTHOR
    Thiago Rondon <thiago@nsms.com.br>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2011 by Thiago Rondon.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

