Advertisement
Guest User

Untitled

a guest
Apr 16th, 2024
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1.  
  2.  
  3.  
  4. rapido::RapidoFormulaResults CachedRapidoServiceProxy::getCachedTimeseries(
  5. const rapido::RapidoFormulaQuery& query) const {
  6. auto queryHash = QueryUtil::getFormulaQueryHashTimeIndifferent(query);
  7. auto match = cache_.find(queryHash);
  8. if (match == cache_.end()) { // No matching datasetId in cache.
  9. // Return empty result if no match. TODO set metadata in result.
  10. return rapido::RapidoFormulaResults{};
  11. } else {
  12. return match->second;
  13. }
  14. }
  15.  
  16. folly::coro::Task<rapido::RapidoFormulaResults>
  17. CachedRapidoServiceProxy::queryFormulaFromSource(
  18. rapido::RapidoFormulaQuery query,
  19. std::optional<std::string> /*rapidoClientId */) const {
  20. auto cacheFormulaResult = getCachedTimeseries(query); // too many timeseries to return from cache, cpu intensive
  21.  
  22. // Found match, return a subset of the cache
  23. auto [startTime, endTime] = QueryUtil::getFormulaQueryTimeRange(query);
  24.  
  25. co_return filterRapidoFormulaResultsByQueryTimeRange(
  26. cacheFormulaResult, startTime, endTime);
  27. }
  28.  
  29.  
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement