https://github.com/bruce-mig/spring-data-redis-cache
Demonstrating usage of Redis as DB cache
https://github.com/bruce-mig/spring-data-redis-cache
mysql redis-cache spring-data-redis-crud-example ttl-cache
Last synced: 25 days ago
JSON representation
Demonstrating usage of Redis as DB cache
- Host: GitHub
- URL: https://github.com/bruce-mig/spring-data-redis-cache
- Owner: bruce-mig
- Created: 2024-11-02T12:24:06.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-18T07:13:56.000Z (over 1 year ago)
- Last Synced: 2025-03-11T21:51:48.049Z (about 1 year ago)
- Topics: mysql, redis-cache, spring-data-redis-crud-example, ttl-cache
- Language: Java
- Homepage:
- Size: 75.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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

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
```bash
git clone git@github.com:bruce-mig/spring-data-redis-cache.git
```
2. Run persistence stack with docker.
```bash
cd spring-data-redis-cache
docker compose up -d
```
3. Start the application
```bash
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
```bash
redis-cli -h -p 6379 -a monitor | grep -v 'info'
```
Learn more about caching at [redis](https://redis.io/solutions/caching/)