Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kieranmueller/v2-redis-springboot-api
Caching with Redis and Spring Boot. (YouTube video not as fresh as repo)
https://github.com/kieranmueller/v2-redis-springboot-api
cache java redis spring
Last synced: about 1 month ago
JSON representation
Caching with Redis and Spring Boot. (YouTube video not as fresh as repo)
- Host: GitHub
- URL: https://github.com/kieranmueller/v2-redis-springboot-api
- Owner: KieranMueller
- Created: 2023-08-16T04:19:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-16T18:26:35.000Z (over 1 year ago)
- Last Synced: 2024-04-20T13:09:12.398Z (9 months ago)
- Topics: cache, java, redis, spring
- Homepage: https://www.youtube.com/watch?v=9VzmVkqbQHg&t=24s
- Size: 79.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# v2-redis-springboot-api
Caching with Redis and Spring Boot# Redis
Redis stands for Remote Dictionary Server. It is used as a distributed,
in-memory key–value database, cache and message broker# Steps
- install Redis, Windows currently unsupported, can either use Windows Subsystem for Linux, or this Windows adaption https://github.com/tporadowski/redis/releases
- run 'redis-server' to start server on default port: 6379
- open new terminal, run 'redis-cli'
- run command 'ping' to test connection, should receive response 'pong'
- configure database settings in application properties, alter maven dependencies as needed
- run project and postman collection
- implemented 2 second delay to GET all request to clearly present functionality of Redis cache in action, time to live is 60 mins
- this means: if you experience a 2 second delay in the GET all request, it was a 'cache miss', this will occur when
- the data is being accessed for the first time and the cache needs to be filled/hydrated
- the data has been altered (PUT, POST, DELETE) since the cache was last accessed or 'hit'
- the time to live expired (60 mins)
- take note of response time between cache misses and cache hits
- take note of logger - logging calls to DB
- run multiple instances of application simultaneously and send requests to see cache in action across the board# TODO
- implement failsafe, ensure application bypasses cache if server is down etc. and hits DB, set max time to try hitting cache, or if response is null, bypass