diff --git a/app/services/github.server.ts b/app/services/github.server.ts index 51d87b5..bd23569 100644 --- a/app/services/github.server.ts +++ b/app/services/github.server.ts @@ -56,7 +56,7 @@ export async function getFileContentWithCache( path: string, ): Promise { const key = `github/${path}`; - const cache = await context.env.CACHE.get(key); + const cache = await context.env.cache.get(key); if (cache) { return cache; @@ -71,7 +71,7 @@ export async function getFileContentWithCache( // Update the cache // TODO: Use `waitUntil` to update the cache in the background - await context.env.CACHE.put(key, content, { expirationTtl: 60 * 60 }); + await context.env.cache.put(key, content, { expirationTtl: 60 * 60 }); return content; } diff --git a/env.d.ts b/env.d.ts index 973e98e..cc30c92 100644 --- a/env.d.ts +++ b/env.d.ts @@ -5,7 +5,7 @@ import '@cloudflare/workers-types'; interface Env { ENVIRONMENT?: 'development'; GITHUB_TOKEN?: string; - CACHE: KVNamespace; + cache: KVNamespace; } declare module '@remix-run/cloudflare' { diff --git a/wrangler.toml b/wrangler.toml index d829a1f..2ebd589 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,4 +1,4 @@ name = "remix-cloudflare-template" kv_namespaces = [ - { id = "CACHE", binding="CACHE" } + { binding = "cache", id = "7bd353e1660544f497319275f6e241fa" } ] \ No newline at end of file