GitHub - HeyPuter/kv.js: Advanced in-memory caching module for JavaScript. For w...
source link: https://github.com/HeyPuter/kv.js
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Advanced in-memory caching module for JavaScript.
For when you need caching but running Redis or Memcached would be an overkill.
KV.JS is a fast, in-memory data store written in pure JavaScript, heavily inspired by Redis and Memcached. It is capable of handling multiple data types, including strings, lists, sets, sorted sets, hashes, and geospatial indexes. Additionally, with more than 140 functions, KV.JS supports a vast variety of operations, ranging from SET
, GET
, EXPIRE
, DEL
to INCR
, DECR
, LPUSH
, RPUSH
, SADD
, SREM
, HSET
, HGET
, and many many more.
Installation
npm install @heyputer/kv.js
Usage
const kvjs = require('@heyputer/kv.js');
// Create a new kv.js instance
const kv = new kvjs();
// Set a key
kv.set('foo', 'bar');
// Get the key's value
kv.get('foo'); // "bar"
// Delete the key
kv.del('foo');
// Set another key
kv.set('username', 'heyputer');
// Automatically delete the key after 60 seconds
kv.expire('username', 60);
More usage examples
decr
decrby
del
exists
expire
expireat
get
getset
incr
incrby
keys
mget
mset
persist
rename
sadd
scard
sdiff
set
sinter
sismember
smove
sort
smembers
spop
ttl
zadd
zcard
zcount
zincrby
zrange
zrangebyscore
zrank
zrem
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK