Advertisement
Guest User

Untitled

a guest
May 14th, 2024
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. auto chartLinksCache =
  2. std::unordered_map<std::pair<time_t, time_t>, ChartLinks> {};
  3. auto chartLinkGenerator = [startTs, endTs, this, &chartLinksCache]() mutable {
  4. if (auto chartLinks = folly::get_optional(
  5. chartLinksCache, std::make_pair(startTs, endTs))) {
  6. LOG(INFO) << "got from cache" << " " << startTs << " " << endTs;
  7. return *chartLinks;
  8. }
  9. auto chartLinks = genChartLinks(startTs, endTs);
  10. LOG(INFO) << "not from cache " << " " << startTs << " " << endTs << "size"
  11. << chartLinksCache.size();
  12. chartLinksCache.emplace(std::make_pair(startTs, endTs), chartLinks);
  13. return chartLinks;
  14. };
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement