MCPcopy Create free account
hub / github.com/bloomberg/pystack / LRUCache

Class LRUCache

src/pystack/_pystack/mem.h:119–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117};
118
119class LRUCache
120{
121 private:
122 struct ListNode
123 {
124 uintptr_t key;
125 size_t size;
126 };
127
128 struct CacheValue
129 {
130 std::vector<char> data;
131 std::list<ListNode>::iterator it;
132 };
133
134 public:
135 explicit LRUCache(size_t cache_capacity);
136
137 void put(uintptr_t key, std::vector<char>&& value);
138 const std::vector<char>& get(uintptr_t key);
139 bool exists(uintptr_t key);
140 bool can_fit(size_t size);
141
142 private:
143 std::list<ListNode> d_cache_list;
144 std::unordered_map<uintptr_t, CacheValue> d_cache;
145 size_t d_cache_capacity;
146 size_t d_size;
147};
148
149class AbstractRemoteMemoryManager
150{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected