Interface AsCacheStrategy

  • All Known Implementing Classes:
    DefaultAsCacheStrategy

    public interface AsCacheStrategy
    Abstraction for interactions with the cache.
    • Method Detail

      • isEnabled

        boolean isEnabled​(AsCacheScope cacheScope)
        Checks if the cache is enabled for the given AsCacheScope.
        Returns:
        true if the cache is enabled, false otherwise
      • getWithLoader

        <V> V getWithLoader​(AsCacheKey cacheKey,
                            java.util.function.Function<AsCacheKey,​V> valueLoader)
        Returns the value in the cache for the given key. If the key is null or the value is not yet in the cache, valueLoader will be used to load the missing value.
        Parameters:
        cacheKey - - the cache key
        valueLoader - - function to load values
        Returns:
        the cached value
      • clear

        void clear()
        Clears the cache by removing all cached entries.
      • getSize

        long getSize()
        Returns number of elements currently in the cache.
      • getHits

        long getHits()
        Returns the hit count.
      • getMisses

        long getMisses()
        Returns the miss count.