6

GitHub - HeyPuter/kv.js: Advanced in-memory caching module for JavaScript. For w...

 1 year ago
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.

KV.JS logo

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

decrdecrbydelexistsexpireexpireatgetgetsetincrincrbykeysmgetmsetpersistrenamesaddscardsdiffsetsintersismembersmovesortsmembersspopttlzaddzcardzcountzincrbyzrangezrangebyscorezrankzrem

License

Distributed under the MIT License. See LICENSE.txt for more information.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK