Interface MemoryCacheConfig
- All Superinterfaces:
Prototype.Api
,Prototype.Factory<MemoryCache>
- All Known Implementing Classes:
MemoryCacheConfig.BuilderBase.MemoryCacheConfigImpl
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:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Fluent API builder forMemoryCache
.static class
MemoryCacheConfig.BuilderBase<BUILDER extends MemoryCacheConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends MemoryCacheConfig> Fluent API builder base forMemoryCache
. -
Method Summary
Modifier and TypeMethodDescriptionstatic MemoryCacheConfig.Builder
builder()
Create a new fluent API builder to customize configuration.static MemoryCacheConfig.Builder
builder
(MemoryCacheConfig instance) Create a new fluent API builder from an existing instance.capacity()
Capacity of the cached bytes of file content.static MemoryCacheConfig
create()
Create a new instance with default values.static MemoryCacheConfig
Create a new instance from configuration.boolean
enabled()
Whether the cache is enabled, defaults totrue
.Methods inherited from interface io.helidon.builder.api.Prototype.Factory
build
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
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
Create a new instance from configuration.- Parameters:
config
- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Create a new instance with default values.- Returns:
- a new instance
-
enabled
boolean enabled()Whether the cache is enabled, defaults totrue
.- Returns:
- whether the cache is enabled
-
capacity
Size capacity()Capacity of the cached bytes of file content. If set to0
, the cache is unlimited. To disable caching, setenabled()
tofalse
, 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)
-