A backend project demonstrating Redis caching in Spring Boot using the
Cache-Aside Pattern, where MySQL is the source of truth and Redis is used for fast reads.
This project avoids Spring’s cache abstraction to explicitly show how caching works internally.
📌 System architecture and flow diagram
- Spring Boot
- Spring Data JPA
- MySQL
- Redis
- RedisTemplate (Manual Caching)
- Maven
Key dependencies:
- spring-boot-starter-web
- spring-boot-starter-data-jpa
- spring-boot-starter-data-redis
- mysql-connector-j
- jackson-databind
- jackson-datatype-jsr310
- lombok
- Java 17+
- Maven
- MySQL
- Redis (Windows build)
Create database:
CREATE DATABASE cache_db;🔗 https://github.com/tporadowski/redis/releases
redis-server --version
Start Redis
redis-server
Verify Redis is Running
redis-cli ping
Expected output:
PONG
Open Redis CLI
redis-cli
KEYS *
Expected:
product:list
product:{id}
GET product:list
TTL product:list
GET → Redis first, DB on cache miss
POST / UPDATE / DELETE
Write to DB first Invalidate Redis cache TTL used as safety net No @Cacheable, no CacheManager Interview-Ready Summary “This project implements a cache-aside pattern using RedisTemplate, where Redis is checked first for reads, MySQL is the source of truth, and cache is invalidated after successful write operations.”

