Sequence Flow for Cache Operations with Multiple Tiers
In order to understand what happens for different cache operations when using multiple tiers, here are examples of Put and Get operations. The sequence diagrams are oversimplified but still show the main points.Figure 2. Multiple tiers using Put
Figure 3. Multiple tiers using Get
You should then notice the following:
When putting a value into the cache, it goes straight to the authoritative tier, which is the lowest tier.
A following
get
will push the value upwards in the caching tiers.Of course, as soon as a value is put in the authoritative tier, all higher-level caching tiers are invalidated.
A full cache miss (the value isn’t on any tier) will always go all the way down to the authoritative tier.
译:为了理解在使用多个层时不同的缓存操作会发生什么情况,图为Put和Get操作的示例。序列图过于简化,但仍然显示了要点。
你应该注意到以下几点:
- 当将一个值放入缓存时,它会直接转到权威层,这是最底层。
- get将在缓存层中向上推送值。
- 一旦将值放入到权威层中,所有更近的缓存层都将失效。
- 缓存丢失(值不在任何层上)总是会一直向下获取直到权威层。
来自官方:http://www.ehcache.org/documentation/3.4/tiering.html#multi-tier-sequence-flow