heyputer / kv.js Goto Github PK
View Code? Open in Web Editor NEW⚡️ Advanced in-memory caching for JavaScript.
License: MIT License
⚡️ Advanced in-memory caching for JavaScript.
License: MIT License
NPM packages nowadays are developed using Typescript and type definitions are exported from the library so that methods and classes are typed. Since this library is entirely written in javascript, one of the following two can be picked to provide type definitions:
npm install -D @types/heyputer__kvjs
Personally, and I believe most others as well, would like to see no. 1 picked and this library converted into a typescript one.
https://github.com/HeyPuter/kv.js/blob/main/kv.js#L2912
I think you mean to refence this.cleanupInterval
?
Also, using a timer to cleanup expired keys is really inefficient and a huge performance suck--especially for a lot of ttl keys. I suggest at least making it optional, if not removing it entirely.
hello.
what is the use of this lib? i didn't understand properly.
(whats the difference between this and a simple value/variable in js?)
Hi
Is it supported CDN way?
Thanks
Eric Xin
Saw your project on https://news.ycombinator.com/item?id=35608601 and the expires
command seems wrong
Lines 119 to 120 in 596ba10
Shouldn't kv.expire('username', 120, 'NX');
mean "Set expirity of username
to 60 seconds if it has no expirity"? The documentation suggests "Set expirity of username
to 60 seconds if username
does not exist" which makes no sense (as the key does not exist and thus can't have expirity).
See redis docs for reference/suggestion https://redis.io/commands/expire/
It looks powerful, but is there a better way to compare its performance? Let's compare its performance with Redis, LocalStorage, and file storage in terms of storage and read speed, making it easier for everyone to choose.
It's often useful to be able to run a callback whenever a certain value changes. For example, maybe whenever the user's timezone changes, different parts of the app want to react in different ways to update clocks and other things.
For example:
const kvjs = require('@heyputer/kv.js');
// Create a new kv.js instance
const kv = new kvjs();
// Watch the key for changes
kv.watch('foo', value => {
console.log('foo changed!', value);
});
// Set a key
kv.set('foo', 42);
// Console will log 'foo changed! 42'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.