--- layout: doc_page --- Druid Caffeine Cache -------------------- A highly performant local cache implementation for Druid based on [Caffeine](https://github.com/ben-manes/caffeine). Requires a JRE8u60 or higher # Configuration Below are the configuration options known to this module: |`runtime.properties`|Description|Default| |--------------------|-----------|-------| |`druid.cache.sizeInBytes`|The maximum size of the cache in bytes on heap.|None (unlimited)| |`druid.cache.expireAfter`|The time (in ms) after an access for which a cache entry may be expired|None (no time limit)| |`druid.cache.cacheExecutorFactory`|The executor factory to use for Caffeine maintenance. One of `COMMON_FJP`, `SINGLE_THREAD`, or `SAME_THREAD`|ForkJoinPool common pool (`COMMON_FJP`)| |`druid.cache.evictOnClose`|If a close of a namespace (ex: removing a segment from a node) should cause an eager eviction of associated cache values|`false`| ## `druid.cache.cacheExecutorFactory` Here are the possible values for `druid.cache.cacheExecutorFactory`, which controls how maintenance tasks are run * `COMMON_FJP` (default) use the common ForkJoinPool. Do NOT use this option unless you are running 8u60 or higher * `SINGLE_THREAD` Use a single-threaded executor * `SAME_THREAD` Cache maintenance is done eagerly # Enabling To enable the caffeine cache, include this module on the loadList and set `druid.cache.type` to `caffeine` in your properties. # Metrics In addition to the normal cache metrics, the caffeine cache implementation also reports the following in both `total` and `delta` |Metric|Description|Normal value| |------|-----------|------------| |`query/cache/caffeine/*/requests`|Count of hits or misses|hit + miss| |`query/cache/caffeine/*/loadTime`|Length of time caffeine spends loading new values (unused feature)|0| |`query/cache/caffeine/*/evictionBytes`|Size in bytes that have been evicted from the cache|Varies, should tune cache `sizeInBytes` so that `sizeInBytes`/`evictionBytes` is approximately the rate of cache churn you desire|