![JAR search and dependency download from the Maven repository](/logo.png)
manual.caffeine.rst Maven / Gradle / Ivy
.. _manual-caffeine:
#####################
Instrumenting Caffeine
#####################
.. highlight:: text
.. rubric:: The ``metrics-caffeine`` module provides ``MetricsStatsCounter``, a metrics listener for
Caffeine_ caches:
.. _Caffeine: https://github.com/ben-manes/caffeine
.. code-block:: java
LoadingCache cache = Caffeine.newBuilder()
.recordStats(() -> new MetricsStatsCounter(registry, "cache"))
.build(key -> key);
The listener publishes these metrics:
+---------------------------+----------------------------------------------------------------------+
| ``hits`` | Number of times a requested item was found in the cache. |
+---------------------------+----------------------------------------------------------------------+
| ``misses`` | Number of times a requested item was not found in the cache. |
+---------------------------+----------------------------------------------------------------------+
| ``loads-success`` | Timer for successful loads into cache. |
+---------------------------+----------------------------------------------------------------------+
| ``loads-failure`` | Timer for failed loads into cache. |
+---------------------------+----------------------------------------------------------------------+
| ``evictions`` | Histogram of eviction weights . |
+---------------------------+----------------------------------------------------------------------+
| ``evictions-weight`` | Total weight of evicted entries. |
+---------------------------+----------------------------------------------------------------------+
| ``evictions.`` | Histogram of eviction weights for each RemovalCause |
+---------------------------+----------------------------------------------------------------------+
© 2015 - 2025 Weber Informatics LLC | Privacy Policy