You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow us to access 'cache name' property from ReqShieldCache (or AsyncCache) #33
I wonder if it need the context for the name in setCacheFunction, getCacheFunction in the above way.
Would CaffeineReqShieldBeanConfiguration consider using getCache by injecting CacheManager?
In addition, ReqShieldAspect, the internal logic of the annotation, is being injected with the bean of the ReqShieldCache type. This injection method does not resolve the issue of multiple caches based on the caffeine cache name, so it seems necessary to switch to cacheManager injection.
@pinest94
The creation of the multiple ReqShield object raises some concerns, since it needs to manage background tasks based on multiple schedules. I’m wondering whether it would be necessary to create multiple ReqShield objects per domain.
Also, as you mentioned in point 2, if ReqShieldAspect receives an injected CacheManager, it might lead to issues where ReqShieldCache cannot properly adhere to the interface implementation contracts.
I think the following approach might be better. Please take a look and share your thoughts:
Update ReqShieldConfiguration so that both setCacheFunction and getCacheFunction can accept a name field as a parameter.
When using ReqShield, the user can utilize the name parameter in setCacheFunction and getCacheFunction to select and interact with the appropriate cache.
With this approach, we can maintain a single ReqShield instance while still supporting multiple caches of different types and names.
cc. @ykhfree
Activity
pinest94 commentedon Oct 1, 2025
@chany714 Is there any problem if I add the caffeine lib (in build.gradle) to the req-shield-spring-example module and write the example code?
chany714 commentedon Oct 1, 2025
@pinest94 Yes, that’s perfectly fine. The example project is just for usage examples, so adding the library is no problem.
pinest94 commentedon Oct 21, 2025
@chany714 I want to make sure that the sync for the direction of progress is correct.
1. Manual configuration setup
I wonder if it need the context for the name in
setCacheFunction,getCacheFunctionin the above way.Would
CaffeineReqShieldBeanConfigurationconsider usinggetCacheby injectingCacheManager?pinest94 commentedon Oct 21, 2025
@chany714
2. Using @ReqShieldCacheable, @ReqShieldCacheEvict annotations
In addition,
ReqShieldAspect, the internal logic of the annotation, is being injected with the bean of theReqShieldCachetype.This injection method does not resolve the issue of multiple caches based on the caffeine cache name, so it seems necessary to switch to
cacheManagerinjection.chany714 commentedon Oct 21, 2025
@pinest94
The creation of the multiple
ReqShieldobject raises some concerns, since it needs to manage background tasks based on multiple schedules. I’m wondering whether it would be necessary to create multipleReqShieldobjects per domain.Also, as you mentioned in point 2, if
ReqShieldAspectreceives an injectedCacheManager, it might lead to issues whereReqShieldCachecannot properly adhere to the interface implementation contracts.I think the following approach might be better. Please take a look and share your thoughts:
ReqShieldConfigurationso that bothsetCacheFunctionandgetCacheFunctioncan accept a name field as a parameter.ReqShield, the user can utilize thenameparameter insetCacheFunctionandgetCacheFunctionto select and interact with the appropriate cache.With this approach, we can maintain a single
ReqShieldinstance while still supporting multiple caches of different types and names.cc. @ykhfree