2014-11-19 00:25:21 +08:00
|
|
|
|
#pragma once
|
2017-06-02 14:47:24 +08:00
|
|
|
|
#include "../acl_cpp_define.hpp"
|
2019-05-09 13:57:51 +08:00
|
|
|
|
#include "../stdlib/noncopyable.hpp"
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#include <list>
|
|
|
|
|
|
2019-05-18 21:19:21 +08:00
|
|
|
|
#ifndef ACL_CLIENT_ONLY
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
struct ACL_HTABLE;
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class hsclient;
|
|
|
|
|
class locker;
|
|
|
|
|
|
2019-05-09 13:57:51 +08:00
|
|
|
|
class ACL_CPP_API hspool : public noncopyable
|
2014-11-19 00:25:21 +08:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param addr_rw {const char*} handlersocket <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mysql <EFBFBD>ϵļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD>ʽΪ<EFBFBD><EFBFBD>ip:port<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ַ<EFBFBD><EFBFBD> handlersocket <EFBFBD>Ķ<EFBFBD>д<EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @param addr_rd {const char*} handlersocket <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mysql <EFBFBD>ϵļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD>ʽΪ<EFBFBD><EFBFBD>ip:port<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ַ<EFBFBD><EFBFBD> handlersocket <EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @param cache_enable {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param retry_enable {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
hspool(const char* addr_rw, const char* addr_rd = NULL,
|
|
|
|
|
bool cache_enable = true, bool retry_enable = true);
|
|
|
|
|
|
|
|
|
|
~hspool();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dbn {const char*} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param tbl {const char*} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param idx {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param flds {const char*} Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD>ʽΪ
|
|
|
|
|
* <EFBFBD>ɷָ<EFBFBD><EFBFBD><EFBFBD> ",; \t" <EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><EFBFBD>磺user_id,user_name,user_mail
|
|
|
|
|
* @param readonly {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
hsclient* peek(const char* dbn, const char* tbl,
|
|
|
|
|
const char* idx, const char* flds, bool readonly = false);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>黹<EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param client {hsclient*}
|
|
|
|
|
*/
|
|
|
|
|
void put(hsclient* client);
|
|
|
|
|
private:
|
|
|
|
|
char* addr_rw_;
|
|
|
|
|
char* addr_rd_;
|
|
|
|
|
bool cache_enable_;
|
|
|
|
|
bool retry_enable_;
|
|
|
|
|
std::list<hsclient*> pool_;
|
|
|
|
|
locker* locker_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|
2019-05-18 21:19:21 +08:00
|
|
|
|
|
|
|
|
|
#endif // ACL_CLIENT_ONLY
|