| 1119 | } |
| 1120 | |
| 1121 | void LIRSCacheShard::Erase(const Slice& key, uint32_t hash) { |
| 1122 | DCHECK(initialized_); |
| 1123 | LIRSThreadState tstate; |
| 1124 | { |
| 1125 | std::lock_guard<MutexType> l(mutex_); |
| 1126 | LIRSHandle* e = static_cast<LIRSHandle*>(table_.Remove(key, hash)); |
| 1127 | if (e != nullptr) { |
| 1128 | // Transition from any state to UNINITIALIZED. There may be external references, so |
| 1129 | // this might not actually free it immediately. |
| 1130 | ToUninitialized(&tstate, e); |
| 1131 | } |
| 1132 | } |
| 1133 | |
| 1134 | // This happens when not holding the mutex for performance reasons. |
| 1135 | CleanupThreadState(&tstate); |
| 1136 | } |
| 1137 | |
| 1138 | size_t LIRSCacheShard::Invalidate(const Cache::InvalidationControl& ctl) { |
| 1139 | DCHECK(initialized_); |