If I use this code:
package main
import (
"log"
badger "github.com/dgraph-io/badger/v3"
)
func main() {
// Open the Badger database located in the /tmp/badger directory.
// It will be created if it doesn't exist.
db, err := badger.Open(badger.DefaultOptions("/tmp/badger"))
if err != nil {
log.Fatal(err)
}
defer db.Close()
// Your code here…
}
I understand that badger writes the data to disk but what about reads? does it also read it from disk? or does it make a copy in memory and read it from there?
What happens is that I want to perform reads in memory but at the same time persist the data on disk if the server shuts down.