Skip to content

saiyedzaidi/spring-cache-self-refresh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-cache-self-refresh

Given one or more methods annotated with the Spring's @Cacheable annotation. Allow the cached data to be refreshed behind the scene, while maintaining the already cached data. A use could be to shield your system against an unstable remote, using a scheduler to get any updates if the remote is available any time.

Requirements: Already configured Spring cache abstraction, with or without any actual provider.

To use: Create a pointcut to intercept the cacheable packages/classes/methods with io.github.yantrashala.springcache.tools.CachingAnnotationsAspect.interceptCacheables(ProceedingJoinPoint) This class register the invocations, keeping a copy of all arguments used for the invocation. CacheOperations class provides the refresh cache method that causes all cached invocations to be re-triggered, resulting in update of the cached values.

Since the utility uses AOP, to run the Test case, please add a javaagent entry to your command line like -javaagent:${user.home}/.m2/repository/org/springframework/spring-agent/2.5.6/spring-agent-2.5.6.jar or simply -javaagent:spring-agent-2.5.6.jar if you have the jar in the same directory.

Extra files: General purpose LoggingAspect and ProfilingAspect

About

Allow cached values to be reloaded transparently, without dropping the already cached data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages