Skip to content

nikola-kovacevic/nest-cache-layer

Repository files navigation

REDIS CACHE SERVICE

Description

Redis cache service for Nest framework.

Installation

npm install

Running the app

# start Redis if you don't have it running
$ sudo docker run --name redis-container -p 6379:6379 -d redis

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Interacting with the app

App exposes the following GET routes for interacting with the cache:

  • http://localhost:3000/clear-cache where you can clear Redis cache
  • http://localhost:3000/item/:id where you can read immediate random values first generated then from cache
  • http://localhost:3000/slow-item/:id on first call it takes 5 secs to get the value, after that it is read from cache without TTL
  • http://localhost:3000/slow-ttl-item/:id on first call it takes 5 secs to get the value, after that it is read from cache with 10 sec TTL

About

Nest.js - Redis cache layer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published