Interface CacheFilter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a filter function to select specific parts of a cache depending on a
ResilienceConfiguration, a
GenericCacheKey, and a cache entry.-
Method Summary
Modifier and TypeMethodDescriptionstatic CacheFilterand(CacheFilter firstFilter, CacheFilter... additionalFilters) Creates a newCacheFilterinstance which represents the conjunction of all passed cache filters.static CacheFilterCreates aCacheFilter, which matches all cache entries associated withGenericCacheKeys that are accessible with respect to the parameters in theResilienceConfiguration.CacheConfigurationin the correspondingResilienceConfiguration.static CacheFilterkeyMatchesParameters(Iterable<Object> parameters) Creates aCacheFilter, which includes all cache entries associated withGenericCacheKeys that are accessible with respect to the passed parameters.static CacheFilterCreates aCacheFilter, which matches all cache entries associated withGenericCacheKeys that are accessible with respect to thePrincipalused at the time when theCacheFilteris applied.
Whether theCacheFilterconsiders thePrincipal, depends on theResilienceIsolationModestored in the correspondingResilienceConfiguration.static CacheFilterkeyMatchesPrincipal(Principal principal) Creates aCacheFilter, which includes all cache entries associated withGenericCacheKeys that are accessible with respect to the passedPrincipal.static CacheFilterCreates aCacheFilter, which matches all cache entries associated withGenericCacheKeys that are accessible with respect to theTenantused at the time when theCacheFilteris applied.
Whether theCacheFilterconsiders theTenant, depends on theResilienceIsolationModestored in the correspondingResilienceConfiguration.static CacheFilterkeyMatchesTenant(Tenant tenant) Creates aCacheFilter, which includes all cache entries associated withGenericCacheKeys that are accessible with respect to the passedTenant.booleanmatches(ResilienceConfiguration configuration, GenericCacheKey<?, ?> cacheKey, Object cacheEntry) Determines whether a specific cache entry matches the expectations of this cache filter.static CacheFilteror(CacheFilter firstFilter, CacheFilter... additionalFilters) Creates a newCacheFilterinstance which represents the disjunction of all passed cache filters.
-
Method Details
-
matches
boolean matches(@Nonnull ResilienceConfiguration configuration, @Nonnull GenericCacheKey<?, ?> cacheKey, @Nullable Object cacheEntry) Determines whether a specific cache entry matches the expectations of this cache filter.- Parameters:
configuration- TheResilienceConfigurationthat is used for the current cache access operation.cacheKey- TheGenericCacheKeythat is associated with the current cache entry.cacheEntry- The actual cache entry.- Returns:
trueif the cache entry should be included,falseotherwise.
-
keyMatchesTenant
Creates aCacheFilter, which includes all cache entries associated withGenericCacheKeys that are accessible with respect to the passedTenant.- Parameters:
tenant- The tenant- Returns:
- A
CacheFilterthat respects the provided tenant.
-
keyMatchesPrincipal
Creates aCacheFilter, which matches all cache entries associated withGenericCacheKeys that are accessible with respect to thePrincipalused at the time when theCacheFilteris applied.
Whether theCacheFilterconsiders thePrincipal, depends on theResilienceIsolationModestored in the correspondingResilienceConfiguration.- Returns:
- A
CacheFilterthat respects principal isolation.
-
keyMatchesPrincipal
Creates aCacheFilter, which includes all cache entries associated withGenericCacheKeys that are accessible with respect to the passedPrincipal.- Parameters:
principal- The principal- Returns:
- A
CacheFilterthat respects the provided principal id
-
keyMatchesTenant
Creates aCacheFilter, which matches all cache entries associated withGenericCacheKeys that are accessible with respect to theTenantused at the time when theCacheFilteris applied.
Whether theCacheFilterconsiders theTenant, depends on theResilienceIsolationModestored in the correspondingResilienceConfiguration.- Returns:
- A
CacheFilterthat respects tenant isolation.
-
keyMatchesParameters
Creates aCacheFilter, which matches all cache entries associated withGenericCacheKeys that are accessible with respect to the parameters in theResilienceConfiguration.CacheConfigurationin the correspondingResilienceConfiguration.- Returns:
- A
CacheFilterthat respects the cache parameters
-
keyMatchesParameters
Creates aCacheFilter, which includes all cache entries associated withGenericCacheKeys that are accessible with respect to the passed parameters.- Parameters:
parameters- The parameters- Returns:
- A
CacheFilterthat respects the provided parameters
-
and
@Nonnull static CacheFilter and(@Nonnull CacheFilter firstFilter, @Nonnull CacheFilter... additionalFilters) Creates a newCacheFilterinstance which represents the conjunction of all passed cache filters.- Parameters:
firstFilter- The first cache filter for the conjunctionadditionalFilters- All additional cache filters which shall be applied as one conjunction- Returns:
- The conjunction of all cache filters
-
or
@Nonnull static CacheFilter or(@Nonnull CacheFilter firstFilter, @Nonnull CacheFilter... additionalFilters) Creates a newCacheFilterinstance which represents the disjunction of all passed cache filters.- Parameters:
firstFilter- The first cache filter for the disjunctionadditionalFilters- All additional cache filters which shall be applied as one disjunction- Returns:
- The disjunction of all cache filters
-