dgraph-io / ristretto

A high performance memory-bound Go cache

Home Page:https://dgraph.io/blog/post/introducing-ristretto-high-perf-go-cache/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

There should be a test-only blocking mode

nes1983 opened this issue · comments

The readme file shows that in order to test ristretto, one must use time.Sleep. As far as I understand, that isn't good software engineering practice. In fact, it's conceptually inherently a race condition. I understand it isn't the kind of race condition that can yield memory corruption. But still -- any test that relies on test.Sleep can fail if it misjudges how long an operation can take.

I'd like to propose a test-only mode that makes the Set operation blocking, until the write has completed. With it, one can write more predictable, simpler unit test.

Github issues have been deprecated.
This issue has been moved to discuss. You can follow the conversation there and also subscribe to updates by changing your notification preferences.

drawing