JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
QueryCache.h
Go to the documentation of this file.
1 //
2 // Created by "Nico Schaefer" on 1/17/17.
3 //
4 
5 #ifndef JODA_QUERYCACHE_H
6 #define JODA_QUERYCACHE_H
7 
10 #include <unordered_map>
11 #include "../../../src/cache/CacheEntry.h"
12 
17 class QueryCache {
18  public:
24  std::shared_ptr<const CacheEntry::CacheIndex> getBestCache(
25  const std::shared_ptr<joda::query::Predicate> &pred);
26 
32  std::shared_ptr<const CacheEntry::CacheIndex> getBestCache(
33  const std::unique_ptr<joda::query::Predicate> &pred);
39  std::shared_ptr<const CacheEntry::CacheIndex> getBestCache(
40  const std::string &predStr);
46  bool cacheAvailable(const std::shared_ptr<joda::query::Predicate> &pred);
52  bool cacheAvailable(const std::string &predStr);
57  void addQueryResult(std::unique_ptr<CacheEntry> &&ce);
63  void addQueryResult(std::shared_ptr<const CacheEntry::CacheIndex> docs,
64  const std::shared_ptr<joda::query::Predicate> &predicate);
65 
69  void reset();
70 
71  protected:
72  std::unordered_map<std::string, std::unique_ptr<CacheEntry>> queryMap;
73 };
74 
75 #endif // JODA_QUERYCACHE_H
Definition: QueryCache.h:17
std::unordered_map< std::string, std::unique_ptr< CacheEntry > > queryMap
Definition: QueryCache.h:72
void addQueryResult(std::unique_ptr< CacheEntry > &&ce)
Definition: QueryCache.cpp:9
void reset()
Definition: QueryCache.cpp:51
bool cacheAvailable(const std::shared_ptr< joda::query::Predicate > &pred)
Definition: QueryCache.cpp:53
std::shared_ptr< const CacheEntry::CacheIndex > getBestCache(const std::shared_ptr< joda::query::Predicate > &pred)
Definition: QueryCache.cpp:29