Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing store: undefined leads to unexpected behavior #1338

Closed
Floriferous opened this issue Mar 11, 2025 · 1 comment
Closed

Passing store: undefined leads to unexpected behavior #1338

Floriferous opened this issue Mar 11, 2025 · 1 comment

Comments

@Floriferous
Copy link

I wrote a cache with something like this:

let store = undefined;

if (someCondition) {
  store = new KeyvMongo();
}

const cache = new Keyv({ store })

When you try to clear the cache, the error is thrown from inside the clear() call. I would expect a default new Map() to be used when store is explicitly set to undefined.

Maybe an error should be thrown if the store is misconfigured?

@jaredwray
Copy link
Owner

@Floriferous - thanks so much for reporting this bug and I put a fix on #1339. It should be released in the next couple weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants