Expose more raw Keyv functionality to enable better extensions.
See original GitHub issueIf Keyv (and official storage adapters) were to expose more internals, this would allow for much richer functionality to be built on top of Keyv.
Mainly:
- Optionally return the raw DB object (#39)
- Get all keys method (#40)
- Delete multiple keys in a single operation (#41)
- Get multiple keys in a single operation (#78)
- Check if key exists (#50 )
Main thing that comes to mind is a DB migrator (needs access to expiry dates) and keyv-shrink which is currently a fork because the desired functionality couldn’t be implemented on top of Keyv.
With the three listed options implemented, keyv-shrink could be implemented efficiently on top of Keyv. All updates to Keyv and Keyv storage adapters would automatically work with keyv-shrink. Example of an implementation could be something like this:
const Keyv = require('keyv');
class KeyvShrink extends Keyv {
shrink() {
...
}
}
@MySidesTheyAreGone What are your thoughts on this? I’m tied up on client project right now but I’m interested in adding this soon.
Issue Analytics
- State:
- Created 6 years ago
- Comments:23 (3 by maintainers)
Top Results From Across the Web
Expose more raw Keyv functionality to enable better extensions.
If Keyv (and official storage adapters) were to expose more internals, this would allow for much richer functionality to be built on top...
Read more >Improve image quality using Camera Raw - Adobe Support
Enhance provides a set of features such as Raw Details and Super Resolution to help improve image quality using Camera Raw.
Read more >Azure Functions HTTP trigger | Microsoft Learn
The HTTP trigger lets you invoke a function with an HTTP request. You can use an HTTP trigger to build serverless APIs and...
Read more >chrome.webRequest - Chrome Developers
The webRequest API only exposes requests that the extension has permission to see, given its host permissions.
Read more >Writing R Extensions - The Comprehensive R Archive Network
The most common is installation which takes a source package and installs it in a library using R CMD INSTALL or install.packages ....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yeah, ok:
This is even more than I need, so no worries.
In the meantime enjoy a bit of science fiction (stage 3 proposal):
https://github.com/tc39/proposal-async-iteration
Defining Symbol.iterator in Keyv’s class:
I can now do this:
This only works if the store is a Map, of course. To make it work on everything we need to implement [Symbol.iterator] in the other stores, which may or may not be difficult.
If we do make it work, it would be enough for a slower but compatible version of shrink() (right now it defines one more column) and keyvrator (which always goes through all of the keys anyway). Probably make a lot of other things possible too.
I don’t know, food for thought.