New from O’Reilly: The memory architecture behind adaptive AI agents

Read the report
For developersHow to cache REST API responses Using Redis & NodeJS
Ajeet Raina
Ajeet Raina

Image

This app returns the number of repositories a Github account has. When you first search for an account, the server calls Github's API to return the response. This can take some time. The server then adds the details of this slow response to Redis for future requests. When you search again, the next response comes directly from Redis cache instead of calling Github. The responses become much faster.

Pre-requisite

1. Install NodeJS

2. Clone the repository

3. Copy .env.sample to create .env

4. Run frontend

5. Run backend

Open up https://localhost:8081 and you can see a basic caching demo application up and running.

Image