acl/lib_acl_cpp/src/redis/redis_pool.cpp

34 lines
648 B
C++
Raw Normal View History

2015-01-14 23:35:23 +08:00
#include "acl_stdafx.hpp"
#include "acl_cpp/redis/redis_client.hpp"
#include "acl_cpp/redis/redis_pool.hpp"
namespace acl
{
redis_pool::redis_pool(const char* addr, int count, size_t idx /* = 0 */)
: connect_pool(addr, count, idx)
, conn_timeout_(30)
, rw_timeout_(60)
2015-01-14 23:35:23 +08:00
{
}
redis_pool::~redis_pool()
{
}
redis_pool& redis_pool::set_timeout(int conn_timeout, int rw_timeout)
2015-01-14 23:35:23 +08:00
{
conn_timeout_ = conn_timeout;
rw_timeout_ = rw_timeout;
return *this;
}
connect_client* redis_pool::create_connect()
{
redis_client* conn = NEW redis_client(addr_, conn_timeout_,
rw_timeout_);
return conn;
}
} // namespace acl