-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document default metadata cache expiration policy #1391
Comments
I'm not sure that we want to provide this level of control. The documentation recommends the following approach:
Does this not meet your needs? |
I am not sure that it does. I don't see how to change the expiration policy duration after the cache is built. This turns into an immutable, complete cache and I don't think any customizer can change those settings without some very ugly hacks. I could of course entirely skip this and supply my own cache, or I could entirely skip the feature altogether and do caching entirely on my own but I don't see how that would be immediately better than having a single-lined setting that says "cache duration is X number of minutes". |
I went ahead with: @Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public JCacheManagerCustomizer initializrMetadataCacheManagerCustomizer() {
return cacheManager -> {
var cacheDuration = Duration.ONE_DAY;
var config = new MutableConfiguration<>()
.setStoreByValue(false)
.setManagementEnabled(true)
.setStatisticsEnabled(true)
.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(cacheDuration));
log.info("Initialize metadata is cached for 1 day");
cacheManager.createCache("initializr.metadata", config);
};
} You can certainly close this out, if you still feel like this level of control is unwarranted. (I would nonetheless consider documenting this) Thank you! |
I believe this is already documented. |
Certainly, yes; To clarify, I meant that the default duration for the cache should be documented as well. i.e.
|
Using version
0.13.0
; At the moment, the default cache customizer does the following:Duration.TEN_MINUTES
, be configurable via application properties? (I am not sure if it's possible to customize this after the fact)I am happy to help and submit a PR if you find this to be reasonable.
The text was updated successfully, but these errors were encountered: