Cachemere
Modular Caching Library for C++
presets.h
1 #ifndef CACHEMERE_PRESETS_H
2 #define CACHEMERE_PRESETS_H
3 
4 #include <absl/hash/hash.h>
5 
6 #include "cache.h"
7 #include "measurement.h"
8 
9 #include "policy/bind.h"
10 #include "policy/constraint_count.h"
11 #include "policy/constraint_memory.h"
12 #include "policy/eviction_lru.h"
13 #include "policy/eviction_segmented_lru.h"
14 #include "policy/eviction_gdsf.h"
15 #include "policy/insertion_always.h"
16 #include "policy/insertion_tinylfu.h"
17 
19 namespace cachemere::presets {
20 
22 namespace memory {
23 
24 template<typename Key,
25  typename Value,
26  template<class, class, class>
27  class InsertionPolicy,
28  template<class, class, class>
29  class EvictionPolicy,
30  typename MeasureValue = measurement::Size<Value>,
31  typename MeasureKey = measurement::Size<Key>,
32  typename KeyHash = absl::Hash<Key>,
33  bool ThreadSafe = true>
35 
44 template<typename Key,
45  typename Value,
46  typename MeasureValue = measurement::Size<Value>,
47  typename MeasureKey = measurement::Size<Key>,
48  typename KeyHash = absl::Hash<Key>,
49  bool ThreadSafe = true>
51 
61 template<typename Key,
62  typename Value,
63  typename MeasureValue = measurement::Size<Value>,
64  typename MeasureKey = measurement::Size<Key>,
65  typename KeyHash = absl::Hash<Key>,
66  bool ThreadSafe = true>
68 
78 template<typename Key,
79  typename Value,
80  typename Cost,
81  typename MeasureValue = measurement::Size<Value>,
82  typename MeasureKey = measurement::Size<Key>,
83  typename KeyHash = absl::Hash<Key>,
84  bool ThreadSafe = true>
86  Value,
89  MeasureValue,
90  MeasureKey,
91  KeyHash,
92  ThreadSafe>;
93 
94 } // namespace memory
95 
97 namespace count {
98 
99 template<typename Key,
100  typename Value,
101  template<class, class, class>
102  class InsertionPolicy,
103  template<class, class, class>
104  class EvictionPolicy,
105  typename MeasureValue = measurement::Size<Value>,
106  typename MeasureKey = measurement::Size<Key>,
107  typename KeyHash = absl::Hash<Key>,
108  bool ThreadSafe = true>
110 
119 template<typename Key,
120  typename Value,
121  typename MeasureValue = measurement::Size<Value>,
122  typename MeasureKey = measurement::Size<Key>,
123  typename KeyHash = absl::Hash<Key>,
124  bool ThreadSafe = true>
126 
136 template<typename Key,
137  typename Value,
138  typename MeasureValue = measurement::Size<Value>,
139  typename MeasureKey = measurement::Size<Key>,
140  typename KeyHash = absl::Hash<Key>,
141  bool ThreadSafe = true>
143 
153 template<typename Key,
154  typename Value,
155  typename Cost,
156  typename MeasureValue = measurement::Size<Value>,
157  typename MeasureKey = measurement::Size<Key>,
158  typename KeyHash = absl::Hash<Key>,
159  bool ThreadSafe = true>
161  Value,
164  MeasureValue,
165  MeasureKey,
166  KeyHash,
167  ThreadSafe>;
168 } // namespace count
169 
170 } // namespace cachemere::presets
171 
172 #endif
cachemere::measurement::Size< Value >
cachemere::policy::InsertionAlways
Simplest insertion policy. Always accepts insertions.
Definition: insertion_always.h:12
cachemere::policy::bind
Binds a Policy<K, KH, V, Args...> template to a Policy<K, KH, V> template to be used with the cache.
Definition: bind.h:7
cachemere::presets
Frequently-used cache presets.
Definition: presets.h:19
cachemere::Cache
Thread-safe memory-restricted cache.
Definition: cache.h:63