Skip to content

Commit

Permalink
Update usage of WithInmemory in db_test and README.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmai committed Dec 23, 2019
1 parent 9453826 commit 6543f65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ Please note that Badger obtains a lock on the directories so multiple processes
cannot open the same database at the same time.

#### In-Memory Mode/Diskless Mode
By default, badger ensures all the data is presisted to the disk. It also supports a pure
`In-Memory` mode. When Badger is running in `in-memory` mode, all the data is stored in the memory.
The read/writes are much faster in `in-memory` mode but all the data stored in badger will be lost
in case of a crash or close. To open badger in `in-memory` mode, set the `InMemory` option.
By default, Badger ensures all the data is persisted to the disk. It also supports a pure
in-memory mode. When Badger is running in in-memory mode, all the data is stored in the memory.
Reads and writes are much faster in in-memory mode, but all the data stored in Badger will be lost
in case of a crash or close. To open badger in in-memory mode, set the `InMemory` option.

```
opt := badger.DefaultOptions("").WithInmemory(true)
opt := badger.DefaultOptions("").WithInMemory(true)
```

### Transactions
Expand Down
10 changes: 5 additions & 5 deletions db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func TestGet(t *testing.T) {
})
})
t.Run("InMemory mode", func(t *testing.T) {
opts := DefaultOptions("").WithInmemory(true)
opts := DefaultOptions("").WithInMemory(true)
db, err := Open(opts)
require.NoError(t, err)
test(t, db)
Expand Down Expand Up @@ -543,7 +543,7 @@ func TestExistsMore(t *testing.T) {
})
})
t.Run("InMemory mode", func(t *testing.T) {
opt := DefaultOptions("").WithInmemory(true)
opt := DefaultOptions("").WithInMemory(true)
db, err := Open(opt)
require.NoError(t, err)
test(t, db)
Expand Down Expand Up @@ -617,7 +617,7 @@ func TestIterate2Basic(t *testing.T) {
})
})
t.Run("InMemory mode", func(t *testing.T) {
opt := DefaultOptions("").WithInmemory(true)
opt := DefaultOptions("").WithInMemory(true)
db, err := Open(opt)
require.NoError(t, err)
test(t, db)
Expand Down Expand Up @@ -1662,7 +1662,7 @@ func TestGoroutineLeak(t *testing.T) {
test(t, nil)
})
t.Run("InMemory mode", func(t *testing.T) {
opt := DefaultOptions("").WithInmemory(true)
opt := DefaultOptions("").WithInMemory(true)
test(t, &opt)
})
}
Expand Down Expand Up @@ -2034,7 +2034,7 @@ func removeDir(dir string) {
}

func TestWriteInemory(t *testing.T) {
opt := DefaultOptions("").WithInmemory(true)
opt := DefaultOptions("").WithInMemory(true)
db, err := Open(opt)
require.NoError(t, err)
defer func() {
Expand Down

0 comments on commit 6543f65

Please sign in to comment.