0.0.1 • Published 5 years ago

functional-cache-redis v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Functional Cache Redis

Cache provider for functional-cache library.

Usage

const cacheFactory = require('functional-cache');
const RedisProvider = require('functional-cache-redis');

const cache = cacheFactory.createNew(new RedisProvider());
const getBooks = cache.cacheCalls(getBooksFromApi);

Customization

Redis cache provider uses Redis npm library. When creating new CacheProvider instance without params, it initiates new client connecting to localhost:6379. This can by configured simply by providing different client instance to RedisProvider constructor:

const redisClientWithDifferentOptions = getRedisClient();
const cache = cacheFactory.createNew(new RedisProvider(redisClientWithDifferentOptions));
const getBooks = cache.cacheCalls(getBooksFromApi);