I want to create a custom spring @Cachable annotation, where i can defined the expire time in seconds. The problem is, i don't know how i implement the new method "expiresInSec()" in the custom annotation.
Here is my custom @Cachable annotation:
@Retention(RetentionPolicy.RUNTIME) @Target( {ElementType.TYPE, ElementType.METHOD}) public @interface Cachable { Cacheable cachable(); // cache entry expires in 1 hour by default int expiresInSec() default 3600; } This is the call of custom annotation:
@Cachable(cachable = @Cacheable("WorkListRepository::getWorkList"), expiresInSec = 60) But the expireInSec parameter doesn't work. Where i must implementing this parameter method.
Thank you