MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / discard_old

Method discard_old

deps/GraphBLAS/CUDA/jitify.hpp:220–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218 size_t _capacity;
219
220 inline void discard_old(size_t n = 0) {
221 if (n > _capacity) {
222 throw std::runtime_error("Insufficient capacity in cache");
223 }
224 while (_objects.size() > _capacity - n) {
225 key_type discard_key = _ranked_keys.back();
226 _ranked_keys.pop_back();
227 _objects.erase(discard_key);
228 }
229 }
230
231 public:
232 inline ObjectCache(size_t capacity = 8) : _capacity(capacity) {}

Callers 2

resizeMethod · 0.95
ObjectCacheClass · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected