aboutsummaryrefslogtreecommitdiff
path: root/src/kv-cache.js
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-03-20 01:28:42 -0700
committerFuwn <[email protected]>2022-03-20 01:28:42 -0700
commit03f2c8e35ba70c9d9496fd5ad5403520f7ebdc53 (patch)
tree568e508aff6db6325719abcb2c601520264c5de4 /src/kv-cache.js
downloadgraphql-api-03f2c8e35ba70c9d9496fd5ad5403520f7ebdc53.tar.xz
graphql-api-03f2c8e35ba70c9d9496fd5ad5403520f7ebdc53.zip
feat: 0.1.0 :star:
Diffstat (limited to 'src/kv-cache.js')
-rw-r--r--src/kv-cache.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/kv-cache.js b/src/kv-cache.js
new file mode 100644
index 0000000..90e4e6b
--- /dev/null
+++ b/src/kv-cache.js
@@ -0,0 +1,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);
+ }
+};