public final class HoconCacheSettingsReader extends Object implements com.atlassian.cache.CacheSettingsDefaultsProvider
CacheSettingsDefaultsProvider that uses a read-only Configuration
file that specifies the cache defaults. The configuration file must be in HOCON (Human-Optimized Config Object Notation) format.
The format of the file must include an entry caches which is an array of objects, that each object contains the following cacheSettingsOverridesProperties:
A config object may contain the following:
CacheSettingsBuilder.expireAfterAccess(long, TimeUnit) hint
CacheSettingsBuilder.expireAfterWrite(long, TimeUnit) hint
CacheSettingsBuilder.flushable() hint CacheSettingsBuilder.local() hint CacheSettingsBuilder.maxEntries(int) hint
CacheSettingsBuilder.replicateAsynchronously() hint
CacheSettingsBuilder.replicateViaCopy() hint An example minimal configuration file is:
// Defaults for local caches
local-defaults = {
local = true
flushable = true
max-entries = 1000
expire-after-access-secs = 360
}
// Defaults for replicated caches
remote-defaults = ${local-defaults} {
local = false
replicate-via-copy = true
}
remote-big = ${remote-defaults} {
expire-after-write-secs = 42
flushable = false
replicate-async = true
replicate-via-copy = false
max-entries = 666666
}
caches = [
{ name = "a.local.cache", config = ${local-defaults} }
{ name = "a.remote.cache", config = ${remote-defaults} }
{ name = "big.ones.*", config = ${remote-big} }
{ name = "reg.+exp[chars(\\", config = ${remote-big} }
{ name = "*", config = ${remote-defaults} }
]
| Constructor and Description |
|---|
HoconCacheSettingsReader(com.atlassian.dc.filestore.api.FileStore.Path configOverridesPath,
org.springframework.core.io.Resource defaultConfigResource) |
| Modifier and Type | Method and Description |
|---|---|
com.atlassian.cache.CacheSettings |
getDefaults(@NonNull String name) |
public HoconCacheSettingsReader(com.atlassian.dc.filestore.api.FileStore.Path configOverridesPath,
org.springframework.core.io.Resource defaultConfigResource)
public com.atlassian.cache.CacheSettings getDefaults(@NonNull String name)
getDefaults in interface com.atlassian.cache.CacheSettingsDefaultsProviderCopyright © 2003–2022 Atlassian. All rights reserved.