October 2017
Intermediate to advanced
396 pages
10h 2m
English
Spring's cache abstraction allows you to create custom caching annotations for your application to recognize the cache method for the cache population or cache eviction. Spring's @Cacheable and @CacheEvict annotations are used as Meta annotations to create custom cache annotation. Let's see the following code for custom annotations in an application:
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@Cacheable(value="accountCache", key="#account.id")
public @interface SlowService {
}
In the preceding code snippet, we have defined a custom annotation named as SlowService, which is annotated with Spring's @Cacheable annotation. If we use @Cacheable in the application, then we have to configure ...
Read now
Unlock full access