Advertisement
Guest User

Untitled

a guest
May 14th, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. std::function<ChartLinks()> chartLinkGenerator =
  2. [startTs,
  3. endTs,
  4. this,
  5. chartLinksCache = std::
  6. unordered_map<std::pair<time_t, time_t>, ChartLinks>{}]() mutable {
  7. if (auto chartLinks = folly::get_optional(
  8. chartLinksCache, std::make_pair(startTs, endTs))) {
  9. LOG(INFO) << "got from cache" << " "<< startTs;
  10. return *chartLinks;
  11. }
  12. auto chartLinks = genChartLinks(startTs, endTs);
  13. LOG(INFO) << "not got from cache ";
  14. chartLinksCache.emplace(std::make_pair(startTs, endTs), chartLinks);
  15. return chartLinks;
  16. };
  17.  
  18.  
  19. for (int i=0;i<=100;i++) {
  20.  
  21. auto result = alertGenerator_->foo(chartLinkGenerator);
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement