How to Create cache instance to keep track of n key value pairs of cost 1?

As the title says, I want to create a ristretto cache instance which can keep track of n key value pairs of 1 cost.

Hi @helloworld,
welcome to the community. Does something like this not work?

cache := ristretto.NewCache(&ristretto.Config{MaxCost:1, NumCounters:n*10}}

@chewxy Thanks for the suggestion. Although I have tried that but it is not working as expected. Set is successful but Get is not able to retrieve the value. I am waiting for 100 ms before calling after Set but still Get is failing. If I set NumCounters to >=500(50*10) then Get is working as expected.

Can you share your code?

https://gist.github.com/darkLord19/bbb7ee5c4bfb9a152efdfebdb3eeeac0 here you go. Last two tests are failing.