зеркало из
https://github.com/iharh/notes.git
synced 2025-11-05 16:16:09 +02:00
22 строки
1.0 KiB
Plaintext
22 строки
1.0 KiB
Plaintext
@Bean
|
|
public JCacheManagerCustomizer cacheManagerCustomizer() {
|
|
return new JCacheManagerCustomizer() {
|
|
@Override
|
|
public void customize(CacheManager cacheManager) {
|
|
FactoryBuilder.SingletonFactory<MyCacheListener> listenerFactory =
|
|
new FactoryBuilder.SingletonFactory<MyCacheListener>(myCacheListener());
|
|
|
|
cacheManager.createCache("myCache", new MutableConfiguration<ResourceKey, ResourceValue>()
|
|
// there is no any memory-based config here available
|
|
.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MINUTES, 1)))
|
|
.setStoreByValue(false)
|
|
.setStatisticsEnabled(true)
|
|
.addCacheEntryListenerConfiguration(
|
|
new MutableCacheEntryListenerConfiguration<ResourceKey, ResourceValue>(
|
|
listenerFactory, null, false, true
|
|
)));
|
|
}
|
|
};
|
|
}
|
|
|