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.

@FunctionalInterface public interface CacheFilter
Represents a filter function to select specific parts of a cache depending on a ResilienceConfiguration, a GenericCacheKey, and a cache entry.
  • 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 - The ResilienceConfiguration that is used for the current cache access operation.
      cacheKey - The GenericCacheKey that is associated with the current cache entry.
      cacheEntry - The actual cache entry.
      Returns:
      true if the cache entry should be included, false otherwise.
    • keyMatchesTenant

      @Nonnull static CacheFilter keyMatchesTenant(@Nonnull Tenant tenant)
      Creates a CacheFilter, which includes all cache entries associated with GenericCacheKeys that are accessible with respect to the passed Tenant.
      Parameters:
      tenant - The tenant
      Returns:
      A CacheFilter that respects the provided tenant.
    • keyMatchesPrincipal

      @Nonnull static CacheFilter keyMatchesPrincipal()
      Creates a CacheFilter, which matches all cache entries associated with GenericCacheKeys that are accessible with respect to the Principal used at the time when the CacheFilter is applied.
      Whether the CacheFilter considers the Principal, depends on the ResilienceIsolationMode stored in the corresponding ResilienceConfiguration.
      Returns:
      A CacheFilter that respects principal isolation.
    • keyMatchesPrincipal

      @Nonnull static CacheFilter keyMatchesPrincipal(@Nonnull Principal principal)
      Creates a CacheFilter, which includes all cache entries associated with GenericCacheKeys that are accessible with respect to the passed Principal.
      Parameters:
      principal - The principal
      Returns:
      A CacheFilter that respects the provided principal id
    • keyMatchesTenant

      @Nonnull static CacheFilter keyMatchesTenant()
      Creates a CacheFilter, which matches all cache entries associated with GenericCacheKeys that are accessible with respect to the Tenant used at the time when the CacheFilter is applied.
      Whether the CacheFilter considers the Tenant, depends on the ResilienceIsolationMode stored in the corresponding ResilienceConfiguration.
      Returns:
      A CacheFilter that respects tenant isolation.
    • keyMatchesParameters

      @Nonnull static CacheFilter keyMatchesParameters()
      Creates a CacheFilter, which matches all cache entries associated with GenericCacheKeys that are accessible with respect to the parameters in the ResilienceConfiguration.CacheConfiguration in the corresponding ResilienceConfiguration.
      Returns:
      A CacheFilter that respects the cache parameters
    • keyMatchesParameters

      @Nonnull static CacheFilter keyMatchesParameters(@Nonnull Iterable<Object> parameters)
      Creates a CacheFilter, which includes all cache entries associated with GenericCacheKeys that are accessible with respect to the passed parameters.
      Parameters:
      parameters - The parameters
      Returns:
      A CacheFilter that respects the provided parameters
    • and

      @Nonnull static CacheFilter and(@Nonnull CacheFilter firstFilter, @Nonnull CacheFilter... additionalFilters)
      Creates a new CacheFilter instance which represents the conjunction of all passed cache filters.
      Parameters:
      firstFilter - The first cache filter for the conjunction
      additionalFilters - 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 new CacheFilter instance which represents the disjunction of all passed cache filters.
      Parameters:
      firstFilter - The first cache filter for the disjunction
      additionalFilters - All additional cache filters which shall be applied as one disjunction
      Returns:
      The disjunction of all cache filters