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

storing each value in a separate file #20

Open
punkish opened this issue May 3, 2022 · 1 comment
Open

storing each value in a separate file #20

punkish opened this issue May 3, 2022 · 1 comment

Comments

@punkish
Copy link

punkish commented May 3, 2022

The constructor example from the docs is a bit strange (for me) in that a random json file would be created every time my program would run (store: new KeyvFile({filename:./cache/default-rnd-${Math.random().toString(36).slice(2).json})). This would not be useful as subsequent runs of my program would not use the previously cached values.

Of course, I can use a static name for my cache (store: new KeyvFile({filename:./cache/default.json})), and that works fine over time. However, keyv-file stores all the keys and their values in the same json file. This would be a problem as the cache grows, and it would also create problems when there are concurrent reads/writes.

Is there a way to store each key-value pair in a separate file, hopefully named using a unique, random cacheKey? If not, I might have to adapt or rewrite a new file adapter.

@BasToTheMax
Copy link

yes, cool feature

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

No branches or pull requests

2 participants