Şu satırı dahil ederiz
<dependency><groupId>com.github.ben-manes.caffeine</groupId><artifactId>caffeine</artifactId><version>3.1.6</version></dependency>
Caffeine'in hızlı olmasının sebebi şöyle.
The main difference is because Caffeine uses ring buffers to record & replay events, whereas Guava uses ConcurrentLinkedQueue. The intent was always to migrate Guava over and it made sense to start simpler, but unfortunately there was never interest in accepting those changes. The ring buffer approach avoids allocation, is bounded (lossy), and cheaper to operate against.Thread
Açıklaması şöyle.
Caffeine, like Guava, does not create threads so it cannot schedule work outside of user activity.Caffeine AsyncCache Arayüzü CompletableFuture nesnesi döner. Bu arayüz ise gerçek nesne döner.
Scheduler
Açıklaması şöyle.
Guava performs expiration on calling threads, so nothing occurs until the next access. You could use Caffeine with a configured scheduler which will perform the work on a background thread.
Hiç yorum yok:
Yorum Gönder