https://github.com/remarkablemark/nextjs-ssr-lru-cache-example
Next.js SSR LRU cache example
https://github.com/remarkablemark/nextjs-ssr-lru-cache-example
Last synced: 9 months ago
JSON representation
Next.js SSR LRU cache example
- Host: GitHub
- URL: https://github.com/remarkablemark/nextjs-ssr-lru-cache-example
- Owner: remarkablemark
- Created: 2022-07-24T01:55:03.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-04T02:27:40.000Z (12 months ago)
- Last Synced: 2025-04-11T05:13:56.639Z (9 months ago)
- Language: JavaScript
- Size: 286 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Next.js SSR LRU Cache Example
Next.js server-side rendering (SSR) least-recently-used (LRU) cache example inspired by the [Gist](https://gist.github.com/leanazulyoro/23c6581fb4379ec311e3bc8538715687).
## Prerequisites
- [Node.js](https://nodejs.org/)
## Demo
- [Replit](https://replit.com/@remarkablemark/Nextjs-SSR-Cache-using-LRU-Cache)
## Install
Clone the repository:
```sh
git clone https://github.com/remarkablemark/nextjs-ssr-lru-cache-example.git
cd nextjs-ssr-lru-cache-example
```
Install the dependencies:
```sh
npm install
```
## Run
Start the Express server on port 3000:
```sh
npm run server
```
When the page is requested for the first time, the HTML will be rendered and cached based on the LRU policy. When the page is requested again, the cached HTML will be returned in the response.
## Resources
- [Make your NextJS site 10-100x faster with Express caching](https://www.peterbe.com/plog/nextjs-faster-with-express-caching)
- [SSR Request Cache for React / NEXT.JS with Cacheable-Response](https://www.christopherkaiser.de/ssr-request-cache-for-react-next/)