Re-inserting a value already represented by the current generation advances its entry counter without adding membership information. Repeating one value can therefore expire unrelated entries sooner than the configured capacity implies.
Detect current-generation membership before rotating. Only repeats already represented by that generation are free; refreshing an older entry consumes capacity normally. Retain the computed hashes so insertion does not hash the value twice.
One trade off is how insert into current generation when present in past generation. For this patch, the intended behavior is to count this as a fresh insert, so that the entry expires with the current insert generation.