NAME

Net::Async::Memcached - 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.

This is the parent class used by Net::Async::Memcached::Client and Net::Async::Memcached::Server.

METHODS

stream

Accessor for internal IO::Async::Stream object representing the underlying memcached transport.

write

Proxies a Protocol::Memcached write request to the underlying transport.

service

Accessor for the service information - this is the port or service name we will attempt to connect to or listen on.

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.