Caching raw page HTML in Redis #65522
-
SummaryHi there, I am looking for a way to hook into the rendering process in order to:
Digging in the code led me to the Unfortunately, it's a private API (although - from what I read on the Internet - quite commonly used) and nowhere do I see a way to overwrite its original implementation. All I need is to wrap it with another function. I've implemented something similar in Nuxt and simply wanted to replicate in Next. Is there anything I can do in that regard? Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
In versions of next.js 13.4 and below, redis caching can be implemented with the following code:
The above is only a brief implementation of the cache, which about redis initialization and cache clearing, setting the code part also needs to be implemented by yourself. This section of code is problematic for versions 13.4.0 and above and does not work in the app directory. |
Beta Was this translation helpful? Give feedback.
-
Thank you @SouthLink. From what I can see, this is a custom Next server implementation (server.js). Is there a way to create this custom implementation in a way that preserves the entire (or at least the majority) of the original Next server implementation and only allows me to wrap I am simply scared of writing my custom server implementation due to the following warning I've found in the documentation: |
Beta Was this translation helpful? Give feedback.
In versions of next.js 13.4 and below, redis caching can be implemented with the following code: