Skip to content

A Cache which instead of evicting an entry on expiration keeps it until it is able to get new Data.

Notifications You must be signed in to change notification settings

eiselems/spring-redis-two-layer-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

@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;
    }
}

About

A Cache which instead of evicting an entry on expiration keeps it until it is able to get new Data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages