com.atlassian.confluence.cache
Class DefaultCacheSettingsManager
java.lang.Object
com.atlassian.confluence.cache.DefaultCacheSettingsManager
- All Implemented Interfaces:
- CacheSettingsManager
public class DefaultCacheSettingsManager
- extends java.lang.Object
- implements CacheSettingsManager
Implementation of CacheSettingsManager
that uses a read-only
Configuration file that specifies the cache defaults.
The configuration file must be in the format to be parsed using the
Typesafe Config Library.
The format of the file must include an entry caches which is an
array of objects, that each object contains the following properties:
- name - name of the caches to match. Note that trailing
wildcards are supported. E.g. "com.*" will match "com.food" and "com."
- config - object containing the properties for the cache. See below.
A config object may contain the following properties:
- expire-after-access-secs - used to set the
CacheBuiler#expireAfterAccess()
hint
- expire-after-write-secs - used to set the
CacheBuiler#expireAfterWrite()
hint
- flushable - used to set the
CacheBuiler#flushable()
hint
- local - used to set the
CacheBuiler#local()
hint
- max-entries - used to set the
CacheBuiler#maxEntries()
hint
- replicate-async - used to set the
CacheBuiler#replicateAsynchronously()
hint
- replicate-via-copy - used to set
CacheBuiler#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} }
]
Method Summary |
com.atlassian.cache.CacheSettings |
obtainDefaults(java.lang.String name)
Obtains the default cache settings. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultCacheSettingsManager
public DefaultCacheSettingsManager(org.springframework.core.io.Resource configResource)
throws java.io.IOException
- Throws:
java.io.IOException
obtainDefaults
public com.atlassian.cache.CacheSettings obtainDefaults(java.lang.String name)
- Description copied from interface:
CacheSettingsManager
- Obtains the default cache settings. from persistent storage, for the specified cache.
- Specified by:
obtainDefaults
in interface CacheSettingsManager
- Parameters:
name
- the name of the cache to obtain default settings
- Returns:
- the default cache settings
Copyright © 2003-2014 Atlassian. All Rights Reserved.