diff --git a/docs/modules/cluster-performance/pages/near-cache.adoc b/docs/modules/cluster-performance/pages/near-cache.adoc index 6a0b19c9a..4de862cc9 100644 --- a/docs/modules/cluster-performance/pages/near-cache.adoc +++ b/docs/modules/cluster-performance/pages/near-cache.adoc @@ -563,6 +563,18 @@ If it is expired, it is evicted and `null` is returned as the value to the calle Note that `max-idle-seconds` and `time-to-live-seconds` are configured under the `near-cache` configuration block, as seen in the above <>. +== Caching of null values + +When you call `get()` on a map with Near Cache enabled and the requested key does not exist in the underlying data structure, the Near Cache stores the `null` result. +This means that subsequent `get()` calls for the same non-existent key are served directly from the Near Cache without requiring a network round-trip to the cluster. + +This behavior provides a performance benefit when your application frequently checks for keys that may not exist, as it avoids repeated server lookups. + +The cached `null` value is subject to the same expiration and invalidation rules as any other Near Cache entry: + +* It expires based on `max-idle-seconds` and `time-to-live-seconds` configuration. +* It is invalidated when an entry with that key is added to the underlying data structure. + == Near Cache Invalidation Invalidation is the process of removing an entry from the Near Cache when its value is updated or