Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::function<ChartLinks()> chartLinkGenerator =
- [startTs,
- endTs,
- this,
- chartLinksCache = std::
- unordered_map<std::pair<time_t, time_t>, ChartLinks>{}]() mutable {
- if (auto chartLinks = folly::get_optional(
- chartLinksCache, std::make_pair(startTs, endTs))) {
- LOG(INFO) << "got from cache" << " "<< startTs;
- return *chartLinks;
- }
- auto chartLinks = genChartLinks(startTs, endTs);
- LOG(INFO) << "not got from cache ";
- chartLinksCache.emplace(std::make_pair(startTs, endTs), chartLinks);
- return chartLinks;
- };
- for (int i=0;i<=100;i++) {
- auto result = alertGenerator_->foo(chartLinkGenerator);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement