Moved from GitHub ristretto/30
Posted by cipriancraciun:
This is more a “design question” than an actual “issue”, however given its implications I think it is an important question which impacts either the design or the usage constraints.
Given that the KeyToHash
(1) function supports string
(and []byte
), and it returns uint64
, it is possible that there are hash collisions.
However the cache.Get
(2) method doesn’t check if the found entry (if any) actually has the given key. (In fact the store
doesn’t even support storing the key.)
(1) https://github.com/dgraph-io/ristretto/blob/master/z/z.go#L20
(2) https://github.com/dgraph-io/ristretto/blob/master/cache.go#L83