allegro / allegro/bigcache

Optional Hasher for int64 type

Offen
#130 4 Kommentare 6 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement question
Vorherrschende Sprache
Go
Sterne
8.2k
Forks
614
Ø Merge
5 T. 12 Std.
Gemergte PRs (30 T.)
1

Beschreibung

Hi, thanks for awesome work! Bigcache working beautiful in production with almost 1 million rpm :)

I'm storing items in cache based in their id (int64 type), but Hasher interface supports only `func Sum64(s string) uint64` method, and because of what I implemented it as follows:
```go
// Sum64 decodes integer from byte representation of string
func (d DummyHash) Sum64(s string) uint64 {
b := []byte(s)
x, _ := binary.Varint(b)
return uint64(x)
}
```
Overhead isn't noticable, but looks hacky. What's your thoughts on this? Did I miss something? Could we extend interface to support int64? I would love to do pr myself, with your help and advice.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.