Skip to content
Browse files

docs updated

  • Loading branch information...
1 parent 83acf05 commit 5680a97ee7d0069d559117185eb054bdd21dfed1 @und3f committed
Showing with 207 additions and 180 deletions.
  1. +2 −0 MANIFEST.SKIP
  2. +0 −180 README
  3. +205 −0 README.pod
View
2 MANIFEST.SKIP
@@ -1,5 +1,7 @@
^blib
^pm_to_blib
.*\.old$
+.*\.bak$
^Makefile$
^\.git
+README.pod
View
180 README
@@ -1,180 +0,0 @@
-NAME
- MojoX::Redis - asynchronous Redis client for Mojolicious.
-
-SYNOPSIS
- use MojoX::Redis;
-
- my $redis = MojoX::Redis->new(server => '127.0.0.1:6379');
-
- # Execute some commands
- $redis->ping(
- sub {
- my ($redis, $res) = @_;
-
- if ($res) {
- print "Got result: ", $res->[0], "\n";
- }
- else {
- print "Error: ", $redis->error, "\n";
- }
- }
- );
-
- # Work with keys
- $redis->set(key => 'value');
-
- $redis->get(
- key => sub {
- my ($redis, $res) = @_;
-
- print "Value of 'key' is $res->[0]\n";
- }
- );
-
-
- # Cleanup connection
- $redis->quit(sub { shift->stop });
-
- # Start IOLoop (in case it is not started yet)
- $redis->start;
-
- Create new Mojo::IOLoop instance if you need to get blocked in a
- Mojolicious application.
-
- use Mojolicious::Lite;
- use MojoX::Redis;
-
- get '/' => sub {
- my $self = shift;
-
- my $redis = MojoX::Redis->new(ioloop => Mojo::IOLoop->new);
-
- my $value;
-
- $redis->set(foo => 'bar')->get(
- foo => sub {
- my ($redis, $result) = @_;
-
- $redis->quit->stop;
-
- return app->log->error($redis->error) unless $result;
-
- $value = $result->[0];
- }
- )->start;
-
- $self->render(text => qq(Foo value is "$value"));
- };
-
- app->start;
-
-DESCRIPTION
- MojoX::Redis is an asynchronous client to Redis for Mojo.
-
-ATTRIBUTES
- MojoX::Redis implements the following attributes.
-
- "server"
- my $server = $redis->server;
- $redis = $redis->server('127.0.0.1:6379');
-
- "Redis" server connection string, defaults to '127.0.0.1:6379'.
-
- "ioloop"
- my $ioloop = $redis->ioloop;
- $redis = $redis->ioloop(Mojo::IOLoop->new);
-
- Loop object to use for io operations, by default a Mojo::IOLoop
- singleton object will be used.
-
- "timeout"
- my $timeout = $redis->timeout;
- $redis = $redis->timeout(100);
-
- Maximum amount of time in seconds a connection can be inactive before
- being dropped, defaults to 300.
-
- "encoding"
- my $encoding = $redis->encoding;
- $redis = $redis->encoding('UTF-8');
-
- Encoding used for stored data, defaults to "UTF-8".
-
- "protocol_redis"
- use Protocol::Redis;
- $redis->protocol_redis("Protocol::Redis");
-
- Protocol::Redis implementation' constructor for parsing. By default
- Protocol::Redis will be used. Parser library must support APIv1.
-
-METHODS
- MojoX::Redis supports Redis' methods.
-
- $redis->set(key => 'value);
- $redis->get(key => sub { ... });
-
- For more details take a look at "execute" method.
-
- Also MojoX::Redis implements the following ones.
-
- "connect"
- $redis = $redis->connect;
-
- Connect to "Redis" server.
-
- "execute"
- $redis = $redis->execute("ping" => sub{
- my ($redis, $result) = @_;
-
- # Process result
- });
- $redis->execute(lrange => ["test", 0, -1] => sub {...});
- $redis->execute(set => [test => "test_ok"]);
-
- Execute specified command on "Redis" server. If error occured during
- request $result will be set to undef, error string can be obtained with
- $redis->error.
-
- "error"
- $redis->execute("ping" => sub {
- my ($redis, $result) = @_;
- die $redis->error unless defined $result;
- });
-
- Returns error occured during command execution. Note that this method
- returns error code just from current command and can be used just in
- callback.
-
- "on_error"
- $redis->on_error(sub{
- my $redis = shift;
- warn 'Redis error ', $redis->error, "\n";
- });
-
- Executes if error occured. Called before commands callbacks.
-
- "start"
- $redis->start;
-
- Starts IOLoop. Shortcut for $redis->ioloop->start;
-
-SEE ALSO
- Protocol::Redis, Mojolicious, Mojo::IOLoop
-
-SUPPORT
- IRC
- #ru.pm on irc.perl.org
-
-DEVELOPMENT
- Repository
- https://github.com/und3f/mojox-redis
-
-AUTHOR
- Sergey Zasenko, "undef@cpan.org".
-
-COPYRIGHT AND LICENSE
- Copyright (C) 2010-2011, Sergey Zasenko
-
- This program is free software, you can redistribute it and/or modify it
- under the terms of the Artistic License version 2.0.
-
View
205 README.pod
@@ -0,0 +1,205 @@
+=head1 NAME
+
+MojoX::Redis - asynchronous Redis client for L<Mojolicious>.
+
+=head1 SYNOPSIS
+
+ use MojoX::Redis;
+
+ my $redis = MojoX::Redis->new(server => '127.0.0.1:6379');
+
+ # Execute some commands
+ $redis->ping(
+ sub {
+ my ($redis, $res) = @_;
+
+ if ($res) {
+ print "Got result: ", $res->[0], "\n";
+ }
+ else {
+ print "Error: ", $redis->error, "\n";
+ }
+ }
+ );
+
+ # Work with keys
+ $redis->set(key => 'value');
+
+ $redis->get(
+ key => sub {
+ my ($redis, $res) = @_;
+
+ print "Value of 'key' is $res->[0]\n";
+ }
+ );
+
+
+ # Cleanup connection
+ $redis->quit(sub { shift->stop });
+
+ # Start IOLoop (in case it is not started yet)
+ $redis->start;
+
+Create new Mojo::IOLoop instance if you need to get blocked in a Mojolicious
+application.
+
+ use Mojolicious::Lite;
+ use MojoX::Redis;
+
+ get '/' => sub {
+ my $self = shift;
+
+ my $redis = MojoX::Redis->new(ioloop => Mojo::IOLoop->new);
+
+ my $value;
+
+ $redis->set(foo => 'bar')->get(
+ foo => sub {
+ my ($redis, $result) = @_;
+
+ $redis->quit->stop;
+
+ return app->log->error($redis->error) unless $result;
+
+ $value = $result->[0];
+ }
+ )->start;
+
+ $self->render(text => qq(Foo value is "$value"));
+ };
+
+ app->start;
+
+=head1 DESCRIPTION
+
+L<MojoX::Redis> is an asynchronous client to Redis for Mojo.
+
+=head1 ATTRIBUTES
+
+L<MojoX::Redis> implements the following attributes.
+
+=head2 C<server>
+
+ my $server = $redis->server;
+ $redis = $redis->server('127.0.0.1:6379');
+
+C<Redis> server connection string, defaults to '127.0.0.1:6379'.
+
+=head2 C<ioloop>
+
+ my $ioloop = $redis->ioloop;
+ $redis = $redis->ioloop(Mojo::IOLoop->new);
+
+Loop object to use for io operations, by default a L<Mojo::IOLoop> singleton
+object will be used.
+
+=head2 C<timeout>
+
+ my $timeout = $redis->timeout;
+ $redis = $redis->timeout(100);
+
+Maximum amount of time in seconds a connection can be inactive before being
+dropped, defaults to C<300>.
+
+=head2 C<encoding>
+
+ my $encoding = $redis->encoding;
+ $redis = $redis->encoding('UTF-8');
+
+Encoding used for stored data, defaults to C<UTF-8>.
+
+=head2 C<protocol_redis>
+
+ use Protocol::Redis::XS;
+ $redis->protocol_redis("Protocol::Redis::XS");
+
+L<Protocol::Redis> implementation' constructor for parsing. By default
+L<Protocol::Redis> will be used. Parser library must support
+L<APIv1|Protocol::Redis/APIv1>.
+
+Using L<Protocol::Redis::XS> instead of default choice can speedup parsing.
+
+=head1 METHODS
+
+L<MojoX::Redis> supports Redis' methods.
+
+ $redis->set(key => 'value);
+ $redis->get(key => sub { ... });
+
+For more details take a look at C<execute> method.
+
+Also L<MojoX::Redis> implements the following ones.
+
+=head2 C<connect>
+
+ $redis = $redis->connect;
+
+Connect to C<Redis> server.
+
+=head2 C<execute>
+
+ $redis = $redis->execute("ping" => sub{
+ my ($redis, $result) = @_;
+
+ # Process result
+ });
+ $redis->execute(lrange => ["test", 0, -1] => sub {...});
+ $redis->execute(set => [test => "test_ok"]);
+
+Execute specified command on C<Redis> server. If error occured during
+request $result will be set to undef, error string can be obtained with
+$redis->error.
+
+=head2 C<error>
+
+ $redis->execute("ping" => sub {
+ my ($redis, $result) = @_;
+ die $redis->error unless defined $result;
+ });
+
+Returns error occured during command execution.
+Note that this method returns error code just from current command and
+can be used just in callback.
+
+=head2 C<on_error>
+
+ $redis->on_error(sub{
+ my $redis = shift;
+ warn 'Redis error ', $redis->error, "\n";
+ });
+
+Executes if error occured. Called before commands callbacks.
+
+=head2 C<start>
+
+ $redis->start;
+
+Starts IOLoop. Shortcut for $redis->ioloop->start;
+
+=head1 SEE ALSO
+
+L<Protocol::Redis>, L<Mojolicious>, L<Mojo::IOLoop>
+
+=head1 SUPPORT
+
+=head2 IRC
+
+ #ru.pm on irc.perl.org
+
+=head1 DEVELOPMENT
+
+=head2 Repository
+
+ https://github.com/und3f/mojox-redis
+
+=head1 AUTHOR
+
+Sergey Zasenko, C<undef@cpan.org>.
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2010-2011, Sergey Zasenko
+
+This program is free software, you can redistribute it and/or modify it under
+the terms of the Artistic License version 2.0.
+

0 comments on commit 5680a97

Please sign in to comment.
Something went wrong with that request. Please try again.