File size: 562 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const cache = new Map()

class CacheHandler {
  constructor(options) {
    this.options = options
    this.cache = {}
    console.log('initialized custom cache-handler')
    console.log('cache handler - esm default export')
  }

  async get(key) {
    console.log('key', key)
    console.log('cache-handler get', key)
    return cache.get(key)
  }

  async set(key, data) {
    console.log('set key', key)
    console.log('cache-handler set', key)
    cache.set(key, {
      value: data,
      lastModified: Date.now(),
    })
  }
}

export default CacheHandler