Skip to content

Instantly share code, notes, and snippets.

@ducan-ne
Created December 31, 2023 16:10
Show Gist options
  • Save ducan-ne/3186e54278223e3f8482ee2329c180e0 to your computer and use it in GitHub Desktop.
Save ducan-ne/3186e54278223e3f8482ee2329c180e0 to your computer and use it in GitHub Desktop.
supabase-cache-cloudflare-worker.ts
function withCacheSupabase(ttl: number) {
return createClient('https://myurl', '.....', {
global: {
fetch(url, options) {
return fetch(url, {
...options,
cf: {
cacheTtl: ttl,
cacheEverything: true,
},
})
},
},
})
}
// usage
withCacheSupabase(30).from('myTable').select()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment