diff options
Diffstat (limited to 'cache/clock_cache.cc')
-rw-r--r-- | cache/clock_cache.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cache/clock_cache.cc b/cache/clock_cache.cc index 078b922dd..090213cb0 100644 --- a/cache/clock_cache.cc +++ b/cache/clock_cache.cc @@ -1444,6 +1444,22 @@ const Cache::CacheItemHelper* BaseHyperClockCache<Table>::GetCacheItemHelper( return h->helper; } +template <class Table> +void BaseHyperClockCache<Table>::ApplyToHandle( + Cache* cache, Handle* handle, + const std::function<void(const Slice& key, Cache::ObjectPtr value, + size_t charge, const CacheItemHelper* helper)>& + callback) { + BaseHyperClockCache<Table>* cache_ptr = + static_cast<BaseHyperClockCache<Table>*>(cache); + auto h = static_cast<const typename Table::HandleImpl*>(handle); + UniqueId64x2 unhashed; + auto hash_seed = cache_ptr->GetShard(h->GetHash()).GetTable().GetHashSeed(); + callback( + ClockCacheShard<Table>::ReverseHash(h->hashed_key, &unhashed, hash_seed), + h->value, h->GetTotalCharge(), h->helper); +} + namespace { // For each cache shard, estimate what the table load factor would be if |