1.0.25 • Published 8 months ago

@bolt.tech/cache-manager v1.0.25

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

BOLT Cache Manager

This is an internal module of BOLT for handling connections to Redis.

Installation

npm i --save @bolt.tech/cache-manager

Initialise CacheManager

Create a cachemanger.ts file and paste below template to initialise your cache manager.

import * as dotenv from "dotenv";
dotenv.config();

import CacheManager from "@bolt.tech/cache-manager";

const db = new CacheManager(process.env.PARAMSTORE_PATH, process.env.NODE_ENV_LOCAL);
export { db };

Class CacheManager takes two arguments as inputs, paramstorePath and isLocal.

paramstorePath can be dev or prod. Set isLocal as "TRUE" in case you want to connect to redis running on your local instance.

Basic Usage

Class CacheManager has certain set of functions defined which can be used to perform actions on Redis/Elasticache.

To get a key from redis

import {db} from "cacheManager.ts"

db.get('key');

To set a key in redis

import {db} from "cacheManager.ts"

db.set('key', 'hello');

db.set() has a default expiry of 240 seconds or 4 mins. To set custom expiry on your keys, you can pass an optional 3rd argument as expiry of key in seconds in this function.

db.set('key', 'custom expiry', 3000);

1.0.25

8 months ago

1.0.24

10 months ago

1.0.22

12 months ago

1.0.23

12 months ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago