Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/modules/cluster-performance/pages/near-cache.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
<<near-cache-configuration-examples, configuration examples>>.

== 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
Expand Down