AnyEvent-MySQL-ConnPool

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

            # connections count. 5 connections by default.
            PoolSize        =>  5,
            # ping interval. 10 seconds by default.
            CheckInterval   =>  10,
        }, 
        sub {
            my($dbh) = @_;
            if( $dbh ) {
                warn "Connect success!";
                $dbh->pre_do("set names latin1");
                $dbh->pre_do("set names utf8");
            }
            else {
                warn "Connect fail: $AnyEvent::MySQL::errstr ($AnyEvent::MySQL::err)";
                $end->send;
            }
        }
    );

lib/AnyEvent/MySQL/ConnPool.pm  view on Meta::CPAN

        "pass", {
            PrintError      =>  1,
            PoolSize        =>  10,
            CheckInterval   =>  5,
        }, 
        sub {
            my($dbh) = @_;
            if( $dbh ) {
                warn "Connect success!";
                $dbh->pre_do("set names latin1");
                $dbh->pre_do("set names utf8");
            }
            else {
                warn "Connect fail: $AnyEvent::MySQL::errstr ($AnyEvent::MySQL::err)";
                $end->send;
            }
        }
    );
    
    # if you need only connection methods, you can use dispatcher object as regular AnyEvent::MySQL connection  object.
    # the difference is: dispatcher applies connection pool functional to your connection object.



( run in 1.095 second using v1.01-cache-2.11-cpan-49f99fa48dc )