ModErn Text Analysis
META Enumerates Textual Applications
cached_index.h
Go to the documentation of this file.
1 
10 #ifndef META_CACHED_INDEX_H_
11 #define META_CACHED_INDEX_H_
12 
13 #include <memory>
14 
15 #include "meta/config.h"
16 
17 namespace cpptoml
18 {
19 class table;
20 }
21 
22 namespace meta
23 {
24 namespace index
25 {
26 
31 template <class Index, template <class, class> class Cache>
32 class cached_index : public Index
33 {
34  public:
45  template <class... Args>
46  cached_index(const cpptoml::table& config, Args&&... args);
47 
48  using primary_key_type = typename Index::primary_key_type;
49  using secondary_key_type = typename Index::secondary_key_type;
50  using postings_data_type = typename Index::postings_data_type;
51 
60  virtual std::shared_ptr<postings_data_type>
61  search_primary(primary_key_type p_id) const override;
62 
67  void clear_cache();
68 
69  private:
73  mutable Cache<primary_key_type, std::shared_ptr<postings_data_type>> cache_;
74 };
75 }
76 }
77 
79 #endif
Decorator class for wrapping indexes with a cache.
Definition: cached_index.h:32
Cache< primary_key_type, std::shared_ptr< postings_data_type > > cache_
The internal cache object.
Definition: cached_index.h:73
The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retrieval, data mining, and other applications of text processing.
Definition: analyzer.h:25
Definition: analyzer.h:20