Replies: 1 comment
-
This have been formalized in #4546 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Caching, and caching server-side, it's a common suggested way to improve the performance of a Remix application if it's consuming some external service that it's slow and can't be made faster.
The usual answer for this is to either use an in-memory cache with the incredible lru-cache package or use something like Redis or Cloudflare KV if deploying to CF, there are of course more options but those are the usual recommendations.
One thing is that, each of them implement their own interface that will depend on the tool you chose. I propose to add to Remix a standardized cache interface and a way to implement that using any of the other tools.
The interface
The interface can be really simple:
And maybe more things, but I think those are the bare-minumum.
The factory function
As with session storages, Remix could have a generic
createCacheStorage
and that can be used to implement cache storages specific for different cache sources.The built-in cache storages
Remix could also provide some built-in cache storages, I think it should have a simple
createMemoryCacheStorage
that uses an in-memory object or Map, maybe acreateFileCacheStorage
, and acreateCloudflareKVCacheStorage
only exported from@remix-run/cloudflare
.The usage
The usage should be really simple, you create a cache storage instance and then you could use it in any part of the app.
Beta Was this translation helpful? Give feedback.
All reactions