NAME
Memcached::Client::Request - Base class for Memcached::Client request drivers
VERSION
version 2.01
SYNOPSIS
Memcached::Client::Request and its subclasses are responsible for managing the completion of a given request to the memcached cluster.
METHODS
generate
Returns a reference to an anonymous subroutine that creates a new object in a Memcache::Client::Request
subclass, currying in the command that is specified as the argument to generate
, and expecting to be invoked as a method on a Memcache::Client
object.
Each subclass of Memcache::Client::Request
is responsible for using generate
to install whatever commands it knows how to implement into the Memcached::Client
namespace.
The resulting subroutine takes a Memcache::Client
object as its first parameter, since it is expected to be called in that context.
It then examines the last argument in the argument list, and if it's a coderef
or an AnyEvent::CondVar
, it is removed and stored for use on completion of the request. Otherwise, an AnyEvent::CondVar
is created, and the request is marked as needing to manage its own event looping.
The request's process
routine is then called with the remainder of the arguments, and any returned objects are then handled by the __submit
routine in Memcached::Client
.
If process
returns no objects, then the submission is assumed to have failed and the objects complete
routine is called to return a result.
Finally, if the request is marked as needing to manage its own event looping, it will wait on the AnyEvent::CondVar
that it created earlier.
log
Log the specified message with an appropriate prefix derived from the class name.
result
Intended to be called by the protocol methods, result
records the result value that it is given, if it is given one.
complete
is called when the request is finished---regardless of whether it succeeded or failed---and it is responsible for invoking the callback to submit the results to their consumer.
If there has been no result gathered, it will return the default if there is one, otherwise it will return undef.
process
process
accepts a key, value and expiration. It does some housekeeping, and assuming the arguments look appropriate, it returns a reference to itself.
process
process
accepts a reference to an array of arrays containing key, value and expiration tuples. For each tuple, it attempts to construct a M::C::Request::Add
object that has a callback that will recognize when all outstanding requests are in and return the aggregate result.
process
process
accepts a key, delta and initial value. It does some housekeeping, and assuming the arguments look appropriate, it returns a reference to itself.
process
process
accepts a reference to an array of arrays of key, delta and initial value tuples. For each tuple, it attempts to construct a M::C::Request::Decr
object that has a callback that will recognize when all outstanding requests are in and return the aggregate result.
process
process
accepts a key. It does some housekeeping, and assuming the arguments look appropriate, it returns a reference to itself.
process
process
accepts a reference to an array of keys. For each key, it attempts to construct a M::C::Request::Delete
object that has a callback that will recognize when all outstanding requests are in and return the aggregate result.
process
process
accepts a key. It does some housekeeping, and assuming the arguments look appropriate, it returns a reference to itself.
process
process
accepts a reference to an array of keys. For each key, it attempts to construct a M::C::Request::Get
object that has a callback that will recognize when all outstanding requests are in and return the aggregate result.
process
process
accepts a command and arguments. It returns it self assuming a command was specified.
process
process
accepts a command and arguments. It returns a reference to itself assuming a command was specified.
server
server
creates a new M::C::Request::Broadcast
object encapsulating the command for a given server.
process
process
accepts a command and arguments. It returns it self assuming a command was specified.
process
process
accepts a command and arguments. It returns it self assuming a command was specified.
server
server
creates a new M::C::Request::Connect
object encapsulating the command for a given server.
AUTHOR
Michael Alan Dorman <mdorman@ironicdesign.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Michael Alan Dorman.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.