本文整理汇总了C++中json::value::find方法的典型用法代码示例。如果您正苦于以下问题:C++ value::find方法的具体用法?C++ value::find怎么用?C++ value::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类json::value
的用法示例。
在下文中一共展示了value::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cppcms_error
cache_pool::cache_pool(json::value const &settings) :
d(new _data())
{
std::string type = settings.get("cache.backend","none");
#ifndef CPPCMS_NO_CACHE
if(type=="thread_shared") {
if(settings.get("service.worker_processes",0)>1)
throw cppcms_error(
"Can't use `thread_shared' backend with more then one process ether set "
"service.worker_processes to 0 or 1 or use cache.backend=\"process_shared\"");
unsigned items = settings.get("cache.limit",64);
d->module=impl::thread_cache_factory(items);
}
else if(type=="process_shared") {
#if defined(CPPCMS_WIN32)
throw cppcms_error("The 'process_shared' backend is not supported under MS Windows and Cygwin platforms");
#elif defined(CPPCMS_NO_PREFOK_CACHE)
throw cppcms_error("The 'process_shared' backend is disabled during build procedure");
#else // has prefork cache
size_t memory = settings.get("cache.memory",16384);
if(memory < 64)
throw cppcms_error("'process_shared' cache backend requires at least 64 KB of cache memory: cache.memory >= 64");
unsigned items = settings.get("cache.limit",memory);
d->module=impl::process_cache_factory(memory*1024,items);
#endif // prefork cache
}
else
#endif // no cache
if(type != "none" ) {
throw cppcms_error("Unsupported cache backend `" + type + "'");
}
#ifndef CPPCMS_NO_TCP_CACHE
if(settings.find("cache.tcp").type()==json::is_object) {
std::vector<std::string> ips=settings.get<std::vector<std::string> >("cache.tcp.ips");
std::vector<int> ports = settings.get<std::vector<int> >("cache.tcp.ports");
if(ips.empty() || ports.empty() || ips.size()!=ports.size()) {
throw cppcms_error("Invalid settings in cache.tcp.ports or cache.tcp.ips");
}
booster::intrusive_ptr<impl::base_cache> l1=d->module;
d->module=impl::tcp_cache_factory(ips,ports,l1);
}
#endif // no tcp cace
}