Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rapido::RapidoFormulaResults CachedRapidoServiceProxy::getCachedTimeseries(
- const rapido::RapidoFormulaQuery& query) const {
- auto queryHash = QueryUtil::getFormulaQueryHashTimeIndifferent(query);
- auto match = cache_.find(queryHash);
- if (match == cache_.end()) { // No matching datasetId in cache.
- // Return empty result if no match. TODO set metadata in result.
- return rapido::RapidoFormulaResults{};
- } else {
- return match->second;
- }
- }
- folly::coro::Task<rapido::RapidoFormulaResults>
- CachedRapidoServiceProxy::queryFormulaFromSource(
- rapido::RapidoFormulaQuery query,
- std::optional<std::string> /*rapidoClientId */) const {
- auto cacheFormulaResult = getCachedTimeseries(query); // too many timeseries to return from cache, cpu intensive
- // Found match, return a subset of the cache
- auto [startTime, endTime] = QueryUtil::getFormulaQueryTimeRange(query);
- co_return filterRapidoFormulaResultsByQueryTimeRange(
- cacheFormulaResult, startTime, endTime);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement