Skip to content

Commit b99f765

Browse files
authored
Merge pull request #7 from AthennaIO/develop
feat(cache): add way to enable/disable cache driver
2 parents 1652931 + 1c0fcaa commit b99f765

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@athenna/cache",
3-
"version": "5.6.0",
3+
"version": "5.7.0",
44
"description": "The cache handler for Athenna Framework.",
55
"license": "MIT",
66
"author": "João Lenon <lenon@athenna.io>",

src/cache/drivers/Driver.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ export abstract class Driver<Client = any> {
6868
) {
6969
const config = Config.get(`cache.stores.${store}`)
7070

71-
this.ttl = options?.ttl || config.ttl
72-
this.enabled = options?.enabled || config.enabled || true
73-
this.maxItems = options?.maxItems || config.maxItems || 1000
74-
this.maxEntrySize = options?.maxEntrySize || config.maxEntrySize
75-
this.prefix = this.sanitizePrefix(options?.prefix || config?.prefix)
7671
this.store = store
72+
this.ttl = options?.ttl ?? config.ttl
73+
this.enabled = options?.enabled ?? config.enabled ?? true
74+
this.maxItems = options?.maxItems ?? config.maxItems ?? 1000
75+
this.maxEntrySize = options?.maxEntrySize || config.maxEntrySize
76+
this.prefix = this.sanitizePrefix(options?.prefix ?? config?.prefix)
7777

7878
if (client) {
7979
this.client = client

0 commit comments

Comments
 (0)