cache.ts 400 Bytes
Newer Older
Chocobozzz's avatar
Chocobozzz committed
1
import { Redis } from '../lib/redis'
2
import * as apicache from 'apicache'
Chocobozzz's avatar
Chocobozzz committed
3

4
5
// Ensure Redis is initialized
Redis.Instance.init()
6

7
8
9
const options = {
  redisClient: Redis.Instance.getClient(),
  appendKey: () => Redis.Instance.getPrefix()
Chocobozzz's avatar
Chocobozzz committed
10
11
}

12
13
const cacheRoute = apicache.options(options).middleware

Chocobozzz's avatar
Chocobozzz committed
14
15
16
// ---------------------------------------------------------------------------

export {
Chocobozzz's avatar
Chocobozzz committed
17
  cacheRoute
Chocobozzz's avatar
Chocobozzz committed
18
}