问题
Consider a Infinispan cache ( version 5.3.0.Final) Which having following properties,
- Have file store
- Passivation is set to true.
I have following problems when understanding the cache behavior.
- Is there two threads for eviction and expiration ?
- When expiration thread runs, what happens to entries which are in file, but has expired ? Do those load back to memory and removed ?
- What is time duration for these threads to run ?
- Does the file store file is append-only file ?
- Does file has a index in this Infinispan version ?
- What exactly stored in file in this Infinispan version ? Is it key-value or just value ?
回答1:
I won't speak about such an old version, but it's likely the same.
The naming is a bit messy, TBH. There's threadpool with id org.infinispan.executors.eviction with single thread by default, which hosts ScheduledTask that processes expiration. Eviction is triggered only when you add something to the data container, and it is processed by the thread that added the new item.
Depends on cache store implementation - cachestore SPI has method purgeExpired() which forces removal of expired entries from the store. Nothing needs to be loaded into memory.
By default it's 1 minute. Search for wakeUpInterval (or wake-up-interval) in configuration.
No, none of the classical file stores. SoftIndexFileStore uses similar technique.
FileCacheStore has just several 'buckets' and is based on key hashCode, SingleFileCacheStore (or KarstenFileCacheStore, depends on your version) has in-memory index.
Both keys and values.
来源:https://stackoverflow.com/questions/28983060/understanding-infinispan-eviction-expiration-and-file-store