Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/katilius/functional-cache-redis
functional-cache provider using Redis as data source
https://github.com/katilius/functional-cache-redis
Last synced: 7 days ago
JSON representation
functional-cache provider using Redis as data source
- Host: GitHub
- URL: https://github.com/katilius/functional-cache-redis
- Owner: katilius
- License: mit
- Created: 2018-12-09T16:21:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T07:41:14.000Z (almost 2 years ago)
- Last Synced: 2024-10-18T09:52:04.290Z (20 days ago)
- Language: JavaScript
- Size: 938 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Functional Cache Redis
Cache provider for [functional-cache](https://www.npmjs.com/package/functional-cache) library.
## Usage
```javascript
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](https://www.npmjs.com/package/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:
```javascript
const redisClientWithDifferentOptions = getRedisClient();
const cache = cacheFactory.createNew(new RedisProvider(redisClientWithDifferentOptions));
const getBooks = cache.cacheCalls(getBooksFromApi);```