Skip to content

When using string as keys, there could be hash collisions, and thus Get could return the wrong data #30

@cipriancraciun

Description

@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

Metadata

Metadata

Assignees

Labels

kind/bugSomething is broken.priority/P1Serious issue that requires eventual attention (can wait a bit)status/acceptedWe accept to work on it.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions