keyv-file icon indicating copy to clipboard operation
keyv-file copied to clipboard

storing each value in a separate file

Open punkish opened this issue 3 years ago • 1 comments

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.

punkish avatar May 03 '22 09:05 punkish

yes, cool feature

BasToTheMax avatar May 20 '22 07:05 BasToTheMax

fixed

zaaack avatar Aug 31 '24 09:08 zaaack