I'm building a site like bbc.com. I want to use stale-while-revalidate for the top headlines, so everyone gets the same data and gets it as quickly as possible.
Further down the page is more personalised content. That stuff shouldn't be cached at all (except maybe in the browser), because it's dependant on the user.
As far as I understand, to use SWR with headers, it's all route-based, and that won't work because I want different caching within the '/' route. My thought is I could have an in-memory cache on each app server which does SWR, and there I would put the top headlines.
Does this sound feasible? It seems like a common problem, but the main SWR lib I see is the frontend one. Does anyone have experience with a good library for doing the same thing on the backend without building it from scratch? Is this approach sounding crazy? I'd rather not introduce the complexity of a separate caching system like redis if I can get away with it, and the size of the cached data is going to be tiny