Return a pointer to slot that points to a cache entry that matches key/hash. If there is no such cache entry, return a pointer to the trailing slot in the corresponding linked list.
| 112 | // matches key/hash. If there is no such cache entry, return a |
| 113 | // pointer to the trailing slot in the corresponding linked list. |
| 114 | LRUHandle** FindPointer(const Slice& key, uint32_t hash) { |
| 115 | LRUHandle** ptr = &list_[hash & (length_ - 1)]; |
| 116 | while (*ptr != nullptr && ((*ptr)->hash != hash || key != (*ptr)->key())) { |
| 117 | ptr = &(*ptr)->next_hash; |
| 118 | } |
| 119 | return ptr; |
| 120 | } |
| 121 | |
| 122 | void Resize() { |
| 123 | uint32_t new_length = 4; |