Skip to content

bruce-mig/spring-data-redis-cache

Repository files navigation

spring-data-redis-cache

This project demostrates the use of Redis as a cache for a MySQL database using the Cache-Aside strategy. It implements dynamic TTL.

Cache Aside Pattern

cache aside pattern

This is the most common way to use Redis as a cache. Cache-aside is an excellent choice for read-heavy applications when cache misses are acceptable. The application handles all data operations when you use a cache-aside pattern, and it directly communicates with both the cache and database.


How to run project

  1. Clone the project
git clone [email protected]:bruce-mig/spring-data-redis-cache.git
  1. Run persistence stack with docker.
cd spring-data-redis-cache
docker compose up -d
  1. Start the application
sudo chmod +x mvnw
./mvnw spring-boot:run

The application is listening on port :9696

You can execute CRUD operations at the path :9696/users.

Monitoring via redis-cli

 redis-cli -h <host> -p 6379 -a <redis-password> monitor | grep -v 'info'

Learn more about caching at redis

About

Demonstrating usage of Redis as DB cache

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages