本文整理汇总了C++中AmConfigReader::loadPluginConf方法的典型用法代码示例。如果您正苦于以下问题:C++ AmConfigReader::loadPluginConf方法的具体用法?C++ AmConfigReader::loadPluginConf怎么用?C++ AmConfigReader::loadPluginConf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AmConfigReader
的用法示例。
在下文中一共展示了AmConfigReader::loadPluginConf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: preload
int MOD_CLS_NAME::preload() {
AmConfigReader cfg;
if(cfg.loadPluginConf(MOD_NAME)) {
INFO("no module configuration for '%s' found, not preloading regular expressions\n",
MOD_NAME);
return 0;
}
bool failed = false;
for (std::map<string,string>::const_iterator it =
cfg.begin(); it != cfg.end(); it++) {
if (add_regex(it->first, it->second)) {
ERROR("compiling regex '%s' for '%s'\n",
it->second.c_str(), it->first.c_str());
failed = true;
} else {
DBG("compiled regex '%s' as '%s'\n", it->second.c_str(), it->first.c_str());
}
}
return failed? -1 : 0;
}
示例2: onLoad
int CCBLRedis::onLoad() {
AmConfigReader cfg;
string redis_server = "127.0.0.1";
string redis_port = "6379";
string redis_reconnect_timers = "5,10,20,50,100,500,1000";
string redis_connections = "10";
string redis_max_conn_wait = "1000";
pass_on_bl_unavailable = false;
full_logging = false;
if(cfg.loadPluginConf(MOD_NAME)) {
INFO(MOD_NAME "configuration file not found, assuming default "
"configuration is fine\n");
} else {
redis_server = cfg.getParameter("redis_server", redis_server);
redis_port = cfg.getParameter("redis_port", redis_port);
redis_reconnect_timers =
cfg.getParameter("redis_reconnect_timers", redis_reconnect_timers);
redis_connections = cfg.getParameter("redis_connections", redis_connections);
redis_max_conn_wait = cfg.getParameter("redis_max_conn_wait", redis_max_conn_wait);
full_logging = cfg.getParameter("redis_full_logging", "no")=="yes";
pass_on_bl_unavailable = cfg.getParameter("pass_on_bl_unavailable", "no")=="yes";
}
unsigned int i_redis_connections;
if (str2i(redis_connections, i_redis_connections)) {
ERROR("could not understand redis_connections=%s\n", redis_connections.c_str());
return -1;
}
unsigned int i_redis_port;
if (str2i(redis_port, i_redis_port)) {
ERROR("could not understand redis_port=%s\n", redis_port.c_str());
return -1;
}
unsigned int i_redis_max_conn_wait;
if (str2i(redis_max_conn_wait, i_redis_max_conn_wait)) {
ERROR("could not understand redis_max_conn_wait=%s\n", redis_max_conn_wait.c_str());
return -1;
}
std::vector<unsigned int> reconnect_timers;
std::vector<string> timeouts_v = explode(redis_reconnect_timers, ",");
for (std::vector<string>::iterator it=
timeouts_v.begin(); it != timeouts_v.end(); it++) {
int r;
if (!str2int(*it, r)) {
ERROR("REDIS reconnect timeout '%s' not understood\n",
it->c_str());
return -1;
}
reconnect_timers.push_back(r);
}
connection_pool.set_config(redis_server, i_redis_port,
reconnect_timers, i_redis_max_conn_wait);
connection_pool.add_connections(i_redis_connections);
connection_pool.start();
DBG("setting max number max_retries to %u (as connections)\n", i_redis_connections);
max_retries = i_redis_connections;
return 0;
}