aboutsummaryrefslogtreecommitdiff
path: root/src/kv-cache.js
blob: 90e4e6b0eb3053f13afd230c7e679c6894f11052 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module.exports = class KVCache {
  get(key) {
    return WORKERS_GRAPHQL_CACHE.get(key);
  }

  set(key, value, options) {
    const opts = {};
    const ttl = options && options.ttl;

    if (ttl) {
      opts.expirationTtl = ttl;
    }

    return WORKERS_GRAPHQL_CACHE.put(key, value, opts);
  }
};