gsllucas / cache-redis

Redis is a powerful tool for caching data in memory, which can increase application benchmark when consuming

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overview

Repository destinated to study app cache strategies, such as cache aside, using Redis.

Redis is a powerful tool for caching data in memory, which can increase application benchmark when consuming

By default, redis is set up with some default credentials, so when app is live for production, it is necessary to provide some configurations in redis.conf such as user, password and other settings like maxmemory allocation

Used Technologies

  • Redis 7.2.4-alpine
  • Typescript 5.4.3
  • Node v20.12.0

Strategy Perfomance Comparison

Cache Strategy: 1ms

Cache Milliseconds Perfomance

HTTP Strategy: 567ms

HTTP Milliseconds Perfomance

Cache aside strategy can be even more rewarding when applied into massive recurrent data

Getting Started

  1. Install dependencies
npm install
  1. Run redis with docker

You can connect to redis with a different instance instead of running a docker, just be sure to let it running in redis://localhost:6379

docker compose up -d --build
  1. Run application
npm run start

Useful links

About

Redis is a powerful tool for caching data in memory, which can increase application benchmark when consuming


Languages

Language:TypeScript 97.9%Language:Dockerfile 2.1%