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!
This commit is contained in:
Kristian Freeman
2019-07-16 12:18:58 -05:00
parent 8a64cc1c67
commit 5a2a591f75
3 changed files with 0 additions and 19 deletions

View File

@@ -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(),
}),

View File

@@ -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 }

View File

@@ -4,4 +4,3 @@ private = false
route = "yoururl.com/*"
account_id = "abc123"
zone_id = "def456"
kv-namespaces = ["GRAPHQL_ON_WORKERS"]