dgraph-io / ristretto

A high performance memory-bound Go cache
https://dgraph.io/blog/post/introducing-ristretto-high-perf-go-cache/
Apache License 2.0
5.54k stars 364 forks source link

[Non-hashed key values in Item]: onEvict should send the non hashed key values #356

Closed yusuf-kh closed 1 month ago

yusuf-kh commented 1 year ago

Have you tried Ristretto before this proposal? and did not find anything similar?

Yes

What you wanted to do.

I want to know the value of the actual key in onEvict hook. However, after storing a key-value pair in ristretto cache, the onEvict method only returns the key's hash, and not its actual value.

Moreover, I do know I can provide my own hash algorithm, but I want to keep using ristretto's default hashing algorithm. Unfortunately, the Hash algorithm isn't a public method, so I can't use that.

What you actually did.

No response

Why wasn't it great, with examples.

No response

Additional information.

No response

mangalaman93 commented 1 year ago

We do not store the key in ristretto, if you care about the key, you could store it in the value.

github-actions[bot] commented 2 months ago

This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.