Class CacheApi

java.lang.Object
io.github.xanthic.cache.core.CacheApi

public final class CacheApi extends Object
Primary API interaction point to build Cache instances.
See Also:
  • Method Details

    • create

      public static <K, V> io.github.xanthic.cache.api.Cache<K,V> create(Consumer<CacheApiSpec<K,V>> spec)
      Builds a generic Cache according to the desired specification.
      Type Parameters:
      K - the type of keys that form the cache
      V - the type of values that are contained in the cache
      Parameters:
      spec - consumer in which the desired cache settings should be specified
      Returns:
      Cache
      Throws:
      io.github.xanthic.cache.api.exception.NoDefaultCacheImplementationException - if a provider is not specified and no default provider has been set
      io.github.xanthic.cache.api.exception.MisconfiguredCacheException - if the cache settings are invalid (e.g., negative max size or expiry time)
      See Also: