| 301 | |
| 302 | template<Cache::EvictionPolicy policy> |
| 303 | void RLCacheShard<policy>::EnforceCapacity(RLThreadState* tstate) { |
| 304 | while (usage_ > capacity_ && rl_.next != &rl_) { |
| 305 | RLHandle* old = rl_.next; |
| 306 | RL_Remove(old); |
| 307 | table_.Remove(old->key(), old->hash()); |
| 308 | if (Unref(old)) { |
| 309 | old->next = tstate->to_remove_head; |
| 310 | tstate->to_remove_head = old; |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | template<Cache::EvictionPolicy policy> |
| 316 | void RLCacheShard<policy>::CleanupThreadState(RLThreadState* tstate) { |