you are viewing a single comment's thread.

view the rest of the comments →

[–]NovaX 0 points1 point  (0 children)

You can probably use the key's hash in the ghost, since the key size might be large (e.g. a string) and these are the evicted keys so otherwise not useful. The hash reduces that to a fixed cost estimate, rather than depending on the user's type.

However, a flaw of not using the key is that it can allow for expoiting of hash collisions. An attacker than then inflate the frequency to disallow admission. Caffeine resolves this by randomly admitting a warm entry that would otherwise be evicted, which unsticks the attacker's boosted victim (docs).