Skip to content

Commit 301bb09

Browse files
committed
fix(badger): handle in-memory directive
1 parent b3ea55c commit 301bb09

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

badger/badger.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515

1616
"dario.cat/mergo"
1717
"github.com/darkweak/storages/core"
18-
badger "github.com/dgraph-io/badger/v3"
19-
lz4 "github.com/pierrec/lz4/v4"
18+
"github.com/dgraph-io/badger/v3"
19+
"github.com/pierrec/lz4/v4"
2020
"go.uber.org/zap"
2121
)
2222

@@ -58,10 +58,7 @@ func Factory(badgerConfiguration core.CacheProvider, logger core.Logger, stale t
5858
logger.Error("An error occurred during the badgerOptions merge from the default options with your configuration.")
5959
}
6060

61-
if badgerOptions.InMemory {
62-
badgerOptions.Dir = ""
63-
badgerOptions.ValueDir = ""
64-
} else {
61+
if !badgerOptions.InMemory {
6562
if badgerOptions.Dir == "" {
6663
badgerOptions.Dir = "souin_dir"
6764
}

badger/caddy/badger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package caddy
55
import (
66
"net/http"
77

8-
caddy "github.com/caddyserver/caddy/v2"
8+
"github.com/caddyserver/caddy/v2"
99
"github.com/caddyserver/caddy/v2/modules/caddyhttp"
1010
"github.com/darkweak/storages/badger"
1111
"github.com/darkweak/storages/core"

0 commit comments

Comments
 (0)