🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@joaootavios/redis-map

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@joaootavios/redis-map

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

unpublished
latest
Source
npmnpm
Version
2.0.3
Version published
Maintainers
1
Created
Source

Information

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

Install

npm install @joaootavios/redis-map

Example of usage

const { RedisAPI, RedisMap } = require("@joaootavios/redis-map");

(async () => {
    
    const connections = await new RedisAPI({
        url: process.env.REDIS, monitor: (type, message) => {
            console.log(`[REDIS] ${type}: ${message}`);
        }
    }).connect();

    // Example using same connection (for two maps);

    // first map;
    const cacheUsers = new RedisMap({
        connections,
        name: "example:cache:users", monitor: (type, message, name) => {
            console.log(name, type, message);
        }
    });

    // second map;
    const cacheApps = new RedisMap({
        connections,
        name: "example:cache:apps", monitor: (type, message, name) => {
            console.log(name, type, message);
        }
    });

    await cacheUsers.set("joao", { plan: "free", balance: 1000 });
    console.log(cacheUsers.get("joao"), "\n");

    await cacheApps.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.

Keywords

redis

FAQs

Package last updated on 15 Jun 2023

Did you know?

Socket

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.

Install

Related posts