Tom Molesworth > Net-Async-Memcached-0.001 > Net::Async::Memcached::Client

Download:
Net-Async-Memcached-0.001.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.001   Source  

NAME ^

Net::Async::Memcached::Client - basic IO::Async support for memcached

VERSION ^

version 0.001

SYNOPSIS ^

 use strict;
 use warnings;
 use IO::Async::Loop;
 use Net::Async::Memcached::Client;
 my $loop = IO::Async::Loop->new;
 
 # Will begin connection immediately on instantiation
 $mc = Net::Async::Memcached::Client->new(
   host    => 'localhost', # this is the default
   loop    => $loop,
   on_connected => sub {
     my $mc = shift;
     my ($k, $v) = qw(hello world);
     $mc->set(
       $k => $v,
       on_complete  => sub {
         $mc->get(
           $k,
           on_complete  => sub {
             my %args = @_;
             print "Value stored was " . $args{value} . "\n";
             $loop->later(sub { $loop->loop_stop });
           },
           on_error  => sub { die "Failed because of @_\n" }
         );
       }
     );
   }
 );

DESCRIPTION ^

Provides basic memcached support - see Protocol::Memcached for a list of available methods.

METHODS ^

new

Instantiate.

Takes the following named parameters:

connect

Connect to the memcached server. Happens automatically if there's no

host

Accessor for the host information - this is the address we will attempt to connect to.

SEE ALSO ^

There's a list of alternative memcached modules in "SEE ALSO" in Protocol::Memcached.

AUTHOR ^

Tom Molesworth <cpan@entitymodel.com>

LICENSE ^

Copyright Tom Molesworth 2011. Licensed under the same terms as Perl itself.

syntax highlighting: