Net::Async::Memcached::Client - basic IO::Async support for memcached
version 0.001
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" } ); } ); } );
Provides basic memcached support - see Protocol::Memcached for a list of available methods.
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 to the memcached server. Happens automatically if there's no
Accessor for the host information - this is the address we will attempt to connect to.
host
There's a list of alternative memcached modules in "SEE ALSO" in Protocol::Memcached.
Tom Molesworth <cpan@entitymodel.com>
Copyright Tom Molesworth 2011. Licensed under the same terms as Perl itself.
To install Net::Async::Memcached, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Async::Memcached
CPAN shell
perl -MCPAN -e shell install Net::Async::Memcached
For more information on module installation, please visit the detailed CPAN module installation guide.