| 323 | |
| 324 | template<Cache::EvictionPolicy policy> |
| 325 | HandleBase* RLCacheShard<policy>::Lookup(const Slice& key, |
| 326 | uint32_t hash, |
| 327 | bool no_updates) { |
| 328 | DCHECK(initialized_); |
| 329 | RLHandle* e; |
| 330 | { |
| 331 | std::lock_guard<decltype(mutex_)> l(mutex_); |
| 332 | e = static_cast<RLHandle*>(table_.Lookup(key, hash)); |
| 333 | if (e != nullptr) { |
| 334 | e->refs.fetch_add(1, std::memory_order_relaxed); |
| 335 | // If this is a no update lookup, skip the modifications. |
| 336 | if (!no_updates) RL_UpdateAfterLookup(e); |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | return e; |
| 341 | } |
| 342 | |
| 343 | template<Cache::EvictionPolicy policy> |
| 344 | void RLCacheShard<policy>::UpdateCharge(HandleBase* handle, size_t charge) { |