Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
A lightweight, high performance in-memory database based on redis. Makes use of the latest ES2015 features (such as Map).
A lightweight, high performance in-memory database based on redis. Makes use of the latest ES2015 features (such as Map).
Install it via npm:
npm install jsredis
And include in your project:
import Database from 'jsredis';
The biggest difference to this and using an actual redis instance is that you can use any type for a hash, field or value, so if you wished you could store functions, classes, arrays, numbers, objects ... etc and not just strings.
All the commands are synchronous, therefore can all be run inline.
BASIC EXAMPLE:
const db = new Database();
if (db.hsetnx('hash', 'field', 'value')) {
console.log(db.hget('hash', 'field')); // logs 'value'
console.log(db.hkeys('hash')); // logs [ 'field' ]
console.log(db.hvals('hash')); // logs [ 'value' ]
console.log(db.hgetall('hash')); // logs [ [ 'field','value' ] ]
console.log(db.hlen('hash')); // logs 1
console.log(db.flushdb()); // logs 1
console.log(db.hlen('hash')); // logs 0
}
If you feel like contributing feel free to fork, make changes and submit a PR.
Still polishing the benchmark scripts but, initial tests have shown the following:
set
completes 1 million
transactions in ~600-700ms
setnx
completes 1 million
transactions in ~80ms
- where exists is truesetnx
completes 1 million
transactions in ~900ms
- where exists is falseget
completes 1 million
transactions in ~90ms
on a key that doesn't existget
completes 1 million
transactions in ~90ms
on a key that exists, pretty much the same result as aboveexists
completes 1 million
transactions in ~80ms
- pretty much same results if key exists or nothset
on a single hash for all transactions 1 million
transactions in ~700-800ms
hset
on a on new hash per transaction completes 1 million
transactions in ~8000-9000ms
MIT
FAQs
A lightweight, high performance in-memory database based on redis. Makes use of the latest ES2015 features (such as Map).
We found that jsredis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.