java.lang.Object
io.helidon.webserver.staticcontent.MemoryCache
All Implemented Interfaces:
RuntimeType.Api<MemoryCacheConfig>

public class MemoryCache extends Object implements RuntimeType.Api<MemoryCacheConfig>
Memory cache to allow in-memory storage of static content, rather than reading it from file system each time the resource is requested.
  • Method Details

    • builder

      public static MemoryCacheConfig.Builder builder()
      A new builder to configure and create a memory cache.
      Returns:
      a new fluent API builder
    • create

      public static MemoryCache create(MemoryCacheConfig config)
      Create a new memory cache from its configuration.
      Parameters:
      config - memory cache configuration
      Returns:
      a new configured memory cache
    • create

      public static MemoryCache create(Consumer<MemoryCacheConfig.Builder> consumer)
      Create a new memory cache customizing its configuration.
      Parameters:
      consumer - configuration consumer
      Returns:
      a new configured memory cache
    • create

      public static MemoryCache create()
      Create an in-memory cache with zero capacity. Only cache(StaticContentHandler, String, CachedHandlerInMemory) will be stored in it, as these are considered required cache records. All calls to cache(StaticContentHandler, String, int, java.util.function.Supplier) will return empty.
      Returns:
      a new memory cache with capacity set to zero
    • prototype

      public MemoryCacheConfig prototype()
      Description copied from interface: RuntimeType.Api
      The prototype as it was received when creating this runtime object instance.
      Specified by:
      prototype in interface RuntimeType.Api<MemoryCacheConfig>
      Returns:
      prototype object used to create this instance