An open API service indexing awesome lists of open source software.

https://github.com/redis-developer/basic-caching-demo-nodejs

This is an example demo app that shows how Redis caching works using Nodejs
https://github.com/redis-developer/basic-caching-demo-nodejs

Last synced: 11 months ago
JSON representation

This is an example demo app that shows how Redis caching works using Nodejs

Awesome Lists containing this project

README

          

# Basic Redis Caching Demo

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 100s of milliseconds. 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 are usually returned in a millisecond or so making it blazing fast.

# Overview video

Here's a short video that explains the project and how it uses Redis:

[![Watch the video on YouTube](https://github.com/redis-developer/basic-caching-demo-nodejs/raw/main/docs/YTThumbnail.png)](https://youtube.com/watch?v=Ov18gLo0Da8)

## Try it out

#### Deploy to Heroku



Deploy to Heorku

#### Deploy to Vercel:


Deploy with Vercel

#### Deploy to Google Cloud



Run on Google Cloud

## How it works?

![How it works](https://github.com/redis-developer/basic-caching-demo-nodejs/raw/main/docs/screenshot001.png)

### 1. How the data is stored:
```
SETEX microsoft 3600 1000
```

### 2. How the data is accessed:
```
GET microsoft
```

## How to run it locally?

#### Copy `.env.sample` to create `.env`. And provide the values for environment variables

- REDIS_ENDPOINT_URI: Redis server URI
- REDIS_PASSWORD: Password to the server

#### Run frontend

```sh
cd client
yarn
yarn serve
```

#### Run backend

``` sh
yarn
yarn start
```