2018-04-17 14:01:06 +02:00
|
|
|
import { Redis } from '../lib/redis'
|
2019-04-25 11:27:13 +02:00
|
|
|
import * as apicache from 'apicache'
|
2018-04-17 14:01:06 +02:00
|
|
|
|
2019-04-25 11:27:13 +02:00
|
|
|
// Ensure Redis is initialized
|
|
|
|
Redis.Instance.init()
|
2018-05-23 10:03:26 +02:00
|
|
|
|
2019-04-25 11:27:13 +02:00
|
|
|
const options = {
|
|
|
|
redisClient: Redis.Instance.getClient(),
|
|
|
|
appendKey: () => Redis.Instance.getPrefix()
|
2018-04-17 14:01:06 +02:00
|
|
|
}
|
|
|
|
|
2019-04-25 11:27:13 +02:00
|
|
|
const cacheRoute = apicache.options(options).middleware
|
|
|
|
|
2018-04-17 14:01:06 +02:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
2018-07-24 14:35:11 +02:00
|
|
|
cacheRoute
|
2018-04-17 14:01:06 +02:00
|
|
|
}
|