NAME

Cache::Memcached::AnyEvent - AnyEvent Compatible Memcached Client

SYNOPSIS

use Cache::Memcached::AnyEvent;

my $memd = Cache::Memcached::AnyEvent->new({
    servers => [ '127.0.0.1:11211' ],
    compress_threshold => 10_000,
    namespace => 'myapp.',
});

$memd->get( $key, sub {
    my ($value) = @_;
    warn "got $value for $key";
});

DESRIPTION

WARNING: ALPHA QUALITY CODE!

This module implements the memcached protocol as a AnyEvent consumer, and it implments both for text and binary protocols.

RATIONALE

There's another alternative AnyEvent memcached client, AnyEvent::Memcached which is perfectly fine, and I have nothing against you using that module, but I had specific itches to scratch:

Prerequisites

This module, Cache::Memcached::AnyEvent, requires the bare minimum prerequisites to install.

There were more than a few modules that get installed for AnyEvent::Memcached (including some modules that I had to install solely for it) and I wanted to avoid it.

Binary Protocol

I was in the mood to implement the binary protocol. I don't believe it's a requirement to do anything, so this is purely a whim.

Unimplemented Methods

get_multi and the like are not implemented yet on AnyEvent::Memcached.

METHODS

new(%args)

compress_threshold => $number
hash_cb => $cb->($key, $memcached)

Specify hashing coderef. Callback must return an index to the list of the servers, where $key belongs to.

namespace => $namespace
procotol => $object
protocol_class => $classname
servers => \@servers

List of servers to use.

%args can also be a hashref.

add($key, $value[, $exptime, $noreply], $cb->($rc))

connect()

Explicitly connects to each server given. You DO NOT need to call this explicitly.

decr($key, $delta[, $initial], $cb->($value))

delete($key, $cb->($rc))

disconnect()

get($key, $cb->($value))

get_handle( $host_port )

get_multi(\@keys, $cb->(\%values));

incr($key, $delta[, $initial], $cb->($value))

protocol($object)

protocol_class($class)

replace($key, $value[, $exptime, $noreply], $cb->($rc))

remove($key, $cb->($rc))

Alias to delete

servers()

set($key, $value[, $exptime, $noreply], $cb->($rc))

stats($cmd, $cb->(\%stats))

version($cb->(\%result))

TODO

Binary stats is not yet implemented.

AUTHOR

Daisuke Maki <daisuke@endeworks.jp>

LICENSE

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

See http://www.perl.com/perl/misc/Artistic.html