Class MemoryCacheConfig.BuilderBase<BUILDER extends MemoryCacheConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends MemoryCacheConfig>

java.lang.Object
io.helidon.webserver.staticcontent.MemoryCacheConfig.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
MemoryCacheConfig.Builder
Enclosing interface:
MemoryCacheConfig

public abstract static class MemoryCacheConfig.BuilderBase<BUILDER extends MemoryCacheConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends MemoryCacheConfig> extends Object implements ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for MemoryCache.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(MemoryCacheConfig prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(MemoryCacheConfig.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends MemoryCacheConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends MemoryCacheConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • enabled

      public BUILDER enabled(boolean enabled)
      Whether the cache is enabled, defaults to true.
      Parameters:
      enabled - whether the cache is enabled
      Returns:
      updated builder instance
      See Also:
    • capacity

      public BUILDER 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.

      Parameters:
      capacity - capacity of the cache in bytes, defaults to 50 million bytes (50 mB)
      Returns:
      updated builder instance
      See Also:
    • enabled

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

      public 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:
      the capacity
    • config

      public Optional<Config> config()
      If this instance was configured, this would be the config instance used.
      Returns:
      config node used to configure this builder, or empty if not configured
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.