Provided by: libmongodbx-class-perl_1.02-3_all bug

NAME

       MongoDBx::Class::ConnectionPool::Rotated - A simple connection pool with rotated
       connections

VERSION

       version 1.02

SYNOPSIS

               # create a MongoDBx::Class object normally:
               use MongoDBx::Class;
               my $dbx = MongoDBx::Class->new(namespace => 'MyApp::Model::DB');

               # instead of connection, create a pool
               my $pool = $dbx->pool(max_conns => 200, type => 'rotated'); # max_conns defaults to 100

               # or, if you need to pass attributes to MongoDB::Connection->new():
               my $pool = $dbx->pool(max_conns => 200, type => 'rotated', params => {
                       host => $host,
                       username => $username,
                       password => $password,
               });

               # get a connection from the pool on a per-request basis
               my $conn = $pool->get_conn;

               # ... do stuff with $conn and return it when done ...

               $pool->return_conn($conn); # not really needed, but good practice for future proofing and quick pool type switching

DESCRIPTION

       MongoDBx::Class::ConnectionPool::Rotated is an implementation of the
       MongoDBx::Class::ConnectionPool Moose role. In this implementation, the pool has a maximum
       number of connections. An index is kept, and whenever someone makes a request for a
       connection, the connection at the current index is returned (but not taken out of the
       pool, as opposed to backup pools), and the index is raised. If a connection does not exist
       yet at the current index and the maximum has not been reached, a new connections is
       created, added to the pool and returned. If the maximum has been reached and the index is
       at the end, it is rotated to the beginning, and the first connection in the pool is
       returned. Therefore, every connection in the pool can be shared by an unlimited number of
       requesters.

       This pool is most appropriate for smaller pools where you want to distribute the workload
       between a set of connections and you don't mind sharing.

CONSUMES

       MongoDBx::Class::ConnectionPool

METHODS

   get_conn()
       Returns the connection at the current index and raises the index. If no connection is
       available at that index and the maximum has not been reached yet, a new connection will be
       created. If the index is at the end, it is returned to the beginning and the first
       connection from the pool is returned.

   return_conn()
       Doesn't do anything in this implementation but required by
       MongoDBx::Class::ConnectionPool.

AUTHOR

       Ido Perlmuter, "<ido at ido50.net>"

BUGS

       Please report any bugs or feature requests to "bug-mongodbx-class at rt.cpan.org", or
       through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MongoDBx-Class
       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MongoDBx-Class>. I will be notified, and
       then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

       You can find documentation for this module with the perldoc command.

               perldoc MongoDBx::Class::ConnectionPool::Rotated

       You can also look for information at:

       •   RT: CPAN's request tracker

           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=MongoDBx::Class>

       •   AnnoCPAN: Annotated CPAN documentation

           <http://annocpan.org/dist/MongoDBx::Class>

       •   CPAN Ratings

           <http://cpanratings.perl.org/d/MongoDBx::Class>

       •   Search CPAN

           <http://search.cpan.org/dist/MongoDBx::Class/>

SEE ALSO

       MongoDBx::Class, MongoDB::Connection.

LICENSE AND COPYRIGHT

       Copyright 2010-2012 Ido Perlmuter.

       This program is free software; you can redistribute it and/or modify it under the terms of
       either: the GNU General Public License as published by the Free Software Foundation; or
       the Artistic License.

       See http://dev.perl.org/licenses/ for more information.

perl v5.14.2                                2012-12-MongoDBx::Class::ConnectionPool::Rotated(3pm)