Class FederationAccessManagerWithHierarchicalCache

java.lang.Object
se.liu.ida.hefquin.federation.access.impl.FederationAccessManagerWithCache
se.liu.ida.hefquin.federation.access.impl.FederationAccessManagerWithHierarchicalCache
All Implemented Interfaces:
StatsProvider, FederationAccessManager

public class FederationAccessManagerWithHierarchicalCache extends FederationAccessManagerWithCache
A federation access manager that uses a hierarchical cache to store federation access results and cardinality estimates.

The cache consists of two cache layers arranged hierarchically. Requests are first looked up in the primary cache layer. If no cached entry is found, the secondary cache layer is consulted. Entries retrieved from the secondary layer are promoted to the primary layer to improve the performance of future lookups.

Both data retrieval requests and cardinality requests are cached. Cache keys are represented by PersistentCacheKey objects, which uniquely identify a request, the targeted federation member, and the type of cached response.

To reduce duplicate request execution, this class stores CompletableFuture instances in the cache whenever possible. If the underlying cache layers preserve the cached futures, concurrent requests for the same data may share both the same future and the same underlying request execution. However, some cache implementations may store serialized or reconstructed representations of cached values rather than the original future instance. In such cases, the degree to which concurrent requests can be coalesced depends on the behavior of the underlying cache layers.

Cache replacement and invalidation behavior are determined by the policies configured for the underlying cache layers.