https://github.com/eiselems/spring-redis-two-layer-cache
A Cache which instead of evicting an entry on expiration keeps it until it is able to get new Data.
https://github.com/eiselems/spring-redis-two-layer-cache
aop cache redis spring-redis
Last synced: 11 months ago
JSON representation
A Cache which instead of evicting an entry on expiration keeps it until it is able to get new Data.
- Host: GitHub
- URL: https://github.com/eiselems/spring-redis-two-layer-cache
- Owner: eiselems
- Created: 2018-12-17T17:27:32.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-15T21:33:23.000Z (over 7 years ago)
- Last Synced: 2025-04-08T22:12:24.420Z (about 1 year ago)
- Topics: aop, cache, redis, spring-redis
- Language: Java
- Homepage:
- Size: 55.7 KB
- Stars: 14
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# spring-redis-two-layer-cache
A Cache which instead of evicting an entry on expiration keeps it until it is able to get new Data.
Technically this is done via Spring AOP.
We create an Around Advice which is guarding our real invocation.
It was created as a drop-in replacement for @Cacheable.
## Usage
The usage is pretty similar to @Cacheable known from the Spring Cache Abstraction.
```java
@Service
public class OrderService {
@TwoLayerRedisCacheable(firstLayerTtl = 1L, secondLayerTtl = 5L, key = "'orders_'.concat(#id).concat(#another)")
public Order getOrder(int id, String other, String another) {
Order order = getOrderViaHTTP(id);
return order;
}
}
```