Application level Ristretto cache supporting Badger transactions

Hi. I need to cache computed values in my application. Ristretto seems to be a good solution for this, but I need my cache to be consistent with Badger’s state - meaning, I need my cache to respect / support Badger’s transactions and isolate reads and writes. Can somebody shed some light on how this is done in Badger internally? Or is there another solution? I would be very happy about some help. Thanks!

Hey @MarcErdmann, each key in badger has a version associated with it. You can cache a value in ristretto and then use the key version to decide if the value should be read from the cache or not.

The txn.Get(...) API would fetch values by default. You can use an iterator with PrefetchValues set to false to fetch only keys.