App::Cerberus::Client - A multi-server client for speaking to App::Cerebrus
use App::Cerberus::Client; my $client = App::Cerberus::Client->new( servers => 'http://localhost:5000', ); my $client = App::Cerberus::Client->new( servers => [ 'http://host1:5000', 'http://host2:5000', ], timeout => 0.2 ); my $info = $client->request( ip => '188.8.131.52, ua => 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' );
App::Cerberus::Client is a simple HTTP client for talking to an App::Cerberus server. If more than one server is specified, they will be rotated in round robin fashion, and if any server fails, the next one will be tried until one responds succesfully, or all servers have failed.
$client = App::Cerberus::Client->new( servers => 'http://host1:5000', OR servers => [ 'http://host1:5000', 'http://host2:5000' ], timeout => 0.1, );
servers params accepts a single server or an array ref of servers. The
timeout param is in seconds (defaults to 0.1 seconds). Keep this low as you don't want an overloaded App::Cerberus server to become a bottleneck.
$info = $client->request(%params);
Sends a request to one of the configured servers, failing over to the next server if there is any error. If all servers fail, it returns an empty hash-ref.
Clinton Gormley <firstname.lastname@example.org>
This software is copyright (c) 2012 by Clinton Gormley.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.