| 86 | } |
| 87 | |
| 88 | void Insert(int key, int value, int charge = 1) { |
| 89 | std::string key_str = EncodeInt(key); |
| 90 | std::string val_str = EncodeInt(value); |
| 91 | auto handle(cache_->Allocate(key_str, val_str.size(), charge)); |
| 92 | CHECK(handle); |
| 93 | memcpy(cache_->MutableValue(&handle), val_str.data(), val_str.size()); |
| 94 | cache_->Insert(std::move(handle), this); |
| 95 | } |
| 96 | |
| 97 | void Erase(int key) { |
| 98 | cache_->Erase(EncodeInt(key)); |