Skip to content
gqlxj1987's Blog
Go back

Caffeine cache

Edit page

原文链接

  1. 愿意消耗一些内存空间来提升速度
  2. 预料到某些键会被多次查询
  3. 缓存中存放的数据总量不会超出内存容量

Caffeine提供三类驱逐策略:

  1. 基于大小(size-based)
  2. 基于时间(time-based)
  3. 基于引用(reference-based)

原文链接1

who is the author of ConcurrentLinkedHashMap on which Guava cache is based.

guava out

Caffeine uses both a Least Recently Used (LRU) eviction policy and a frequency-based admission policy relying on CountMin sketch. It has a better hit rate than LRU for many workloads.

使用ring buffers的方式,The ring buffer approach avoids allocation, is bounded (lossy), and cheaper to operate against.

Caffeine uses ring buffers to record & replay events, whereas Guava uses ConcurrentLinkedQueue.


Edit page
Share this post on:

Previous Post
Hystrix intro
Next Post
Cloak