Giriş
Guava desteği artık yok. Caffeine kullanmak gerekiyor.
Şöyle yaparız
// From:
GuavaCacheManager guavaCacheManager = new GuavaCacheManager();
guavaCacheManager.setCacheBuilder(CacheBuilder.newBuilder()
.expireAfterWrite(1, CACHE_TIME_UNIT));
// To:
CaffeineCacheManager cacheManager = new CaffeineCacheManager();
cacheManager.setCaffeine(Caffeine.newBuilder()
.expireAfterWrite(1, CACHE_TIME_UNIT));
constructor
Örnek
Şöyle yaparız.
Şöyle yaparız.
Şöyle yaparız.
Şöyle yaparız.
@Bean
public CacheManager cacheManager() {
GuavaCacheManager guavaCacheManager = new GuavaCacheManager();
guavaCacheManager.setCacheBuilder(CacheBuilder.newBuilder()
.expireAfterWrite(10, TimeUnit.MINUTES));
return guavaCacheManager;
}
constructor - String
ÖrnekŞöyle yaparız.
@Bean
public CacheManager cacheManager() {
return new GuavaCacheManager("CustomerCache");
}
ÖrnekŞöyle yaparız.
@Bean
public CacheManager cacheManager() {
GuavaCacheManager cacheManager = new GuavaCacheManager("ceepCache");
CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder().maximumSize(100)
.expireAfterWrite(10,TimeUnit.MINUTES);
cacheManager.setCacheBuilder(cacheBuilder);
return cacheManager;
}
Hiç yorum yok:
Yorum Gönder