Interface MemoryCacheConfig

All Superinterfaces:
Prototype.Api, Prototype.Factory<MemoryCache>
All Known Implementing Classes:
MemoryCacheConfig.BuilderBase.MemoryCacheConfigImpl

public interface MemoryCacheConfig extends Prototype.Api
Configuration of memory cache for static content. The memory cache will cache the first bytes that fit into the configured memory size for the duration of the service uptime.
See Also:
  • Method Details

    • builder

      static MemoryCacheConfig.Builder builder()
      Create a new fluent API builder to customize configuration.
      Returns:
      a new builder
    • builder

      static MemoryCacheConfig.Builder builder(MemoryCacheConfig instance)
      Create a new fluent API builder from an existing instance.
      Parameters:
      instance - an existing instance used as a base for the builder
      Returns:
      a builder based on an instance
    • create

      static MemoryCacheConfig create(Config config)
      Create a new instance from configuration.
      Parameters:
      config - used to configure the new instance
      Returns:
      a new instance configured from configuration
    • create

      static MemoryCacheConfig create()
      Create a new instance with default values.
      Returns:
      a new instance
    • enabled

      boolean enabled()
      Whether the cache is enabled, defaults to true.
      Returns:
      whether the cache is enabled
    • capacity

      Size capacity()
      Capacity of the cached bytes of file content. If set to 0, the cache is unlimited. To disable caching, set enabled() to false, or do not configure a memory cache at all.

      The capacity must be less than Long.MAX_VALUE bytes, though you must be careful still, as it must fit into the heap size.

      Returns:
      capacity of the cache in bytes, defaults to 50 million bytes (50 mB)