1.0.5 • Published 6 years ago

swapez-cache-repo v1.0.5

Weekly downloads
4
License
ISC
Repository
-
Last release
6 years ago

VNNG Repository

Cache Repository for Swap-Ez's services

Installation

npm install swapez-cache-repo --save

or

yarn add cache-repo

Usage

const cacheRepo = require('swapez-cache-repo');

const cacheStoreSettings = () => ({
    host: process.env.REDIS_HOST || 'localhost',
    port: process.env.REDIS_PORT || 'port',
    password: process.env.REDIS_PWD || 'password'
});
const connect = (cacheStoreSettings) => new Promise(function (resolve, reject) {
    const redisClient = new redis.createClient(cacheStoreSettings());
    redisClient.on('ready', () => {
        debug('ready');
        resolve(redisClient);
    });

    redisClient.on('error', (err) => {
        debug('error');
        reject(err);
    });
});

connect(cacheStoreSettings).then((redisClient) => {
    const container = createContainer();
    container.register(CACHE_STORE, asValue(redisClient));
    return cacheRepo.connect(container);
}).then((container) => {
    const { checkExistsAnonymous } = container.cradle.cacheRepo;
});
1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago