The Perl Toolchain Summit 2025 Needs You: You can help 🙏 Learn more

NAME

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

VERSION

version 0.001

SYNOPSIS

use strict;
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:

  • loop - IO::Async::Loop object (required)

  • host - address to connect to, default localhost

  • service - port to connect to, default 11211

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.