| 117 | }; |
| 118 | |
| 119 | class 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 | |
| 149 | class AbstractRemoteMemoryManager |
| 150 | { |
nothing calls this directly
no outgoing calls
no test coverage detected