From 5a2a591f750743b6c86263e3c1bbaf12e680609a Mon Sep 17 00:00:00 2001 From: Kristian Freeman Date: Tue, 16 Jul 2019 12:18:58 -0500 Subject: [PATCH] Remove KV caching We don't have the tooling to properly support this - I'd like to return to it in a couple months, but this project is functional without the cache, too! --- src/handlers/apollo.js | 2 -- src/kv-cache.js | 16 ---------------- wrangler.toml.example | 1 - 3 files changed, 19 deletions(-) delete mode 100644 src/kv-cache.js diff --git a/src/handlers/apollo.js b/src/handlers/apollo.js index 1b0efab..0742ef8 100644 --- a/src/handlers/apollo.js +++ b/src/handlers/apollo.js @@ -1,7 +1,6 @@ const { ApolloServer, gql } = require('apollo-server-cloudflare') const { graphqlCloudflare } = require('apollo-server-cloudflare/dist/cloudflareApollo') const { PokemonAPI } = require('../pokeapi') -const { KVCache } = require('../kv-cache') const typeDefs = gql` type PokemonSprites { @@ -40,7 +39,6 @@ const server = new ApolloServer({ typeDefs, resolvers, introspection: true, - cache: new KVCache(), dataSources: () => ({ pokemonAPI: new PokemonAPI(), }), diff --git a/src/kv-cache.js b/src/kv-cache.js deleted file mode 100644 index b284531..0000000 --- a/src/kv-cache.js +++ /dev/null @@ -1,16 +0,0 @@ -class KVCache { - get(key) { - return GRAPHQL_ON_WORKERS.get(key) - } - - set(key, value, options) { - const opts = {} - const ttl = options && options.ttl - if (ttl) { - opts.expirationTtl = ttl - } - return GRAPHQL_ON_WORKERS.put(key, value, opts) - } -} - -module.exports = { KVCache } diff --git a/wrangler.toml.example b/wrangler.toml.example index 8facb14..f482e3d 100644 --- a/wrangler.toml.example +++ b/wrangler.toml.example @@ -4,4 +4,3 @@ private = false route = "yoururl.com/*" account_id = "abc123" zone_id = "def456" -kv-namespaces = ["GRAPHQL_ON_WORKERS"]