Skip to content

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Information

A simple way to use something similar to the Map in javascript, but synchronized with the power of Redis.

Install

npm install @squarecloudofc/redis-map

Example of usage

const{ RedisAPI, RedisMap }=require("@squarecloudofc/redis-map");(async()=>{constconnections=awaitnewRedisAPI({url: process.env.REDIS,monitor: (type,message)=>{console.log(`[REDIS] ${type}: ${message}`);}}).connect();// Example using same connection (for two maps);// first map;constcacheUsers=newRedisMap({
connections,name: "example:cache:users",monitor: (type,message,name)=>{console.log(name,type,message);}});// second map;constcacheApps=newRedisMap({
connections,name: "example:cache:apps",sync: false// disable sync with redis;});awaitcacheUsers.set("joao",{plan: "free",balance: 1000});console.log(cacheUsers.get("joao"),"\n");awaitcacheApps.set("water_man",{protection: 10,shield: 50});console.log(cacheApps.get("water_man"),"\n");connections.disconnect();})();

LICENSE

This project is licensed under the Apache License 2.0.

Sponsored by Square Cloud.

About

A simple way to use something similar to the Map in JavaScript, but synchronized with the power of Redis.

Topics

Resources

Stars

10 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages