Package one.microstream.cache.types
Interface CacheConfiguration<K,V>
- Type Parameters:
K
- the key typeV
- the value type
- All Superinterfaces:
javax.cache.configuration.CompleteConfiguration<K,V>
,javax.cache.configuration.Configuration<K,V>
,Serializable
- All Known Implementing Classes:
CacheConfiguration.Default
public interface CacheConfiguration<K,V>
extends javax.cache.configuration.CompleteConfiguration<K,V>
Extended
CompleteConfiguration
used by MicroStream's Cache
.
Added features:
- getEvictionManagerFactory()
- getSerializerFieldPredicate()
Can be adapted to MicroStream's generic Configuration
layer.
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
CacheConfiguration.Builder<K,V>
static class
CacheConfiguration.Default<K,V>
-
Method Summary
Modifier and Type Method Description static <K, V> CacheConfiguration.Builder<K,V>
Builder(Class<K> keyType, Class<V> valueType)
Creates a newCacheConfiguration.Builder
for aCacheConfiguration
.static <K, V> CacheConfiguration.Builder<K,V>
Builder(Class<K> keyType, Class<V> valueType, String cacheName, EmbeddedStorageManager storageManager)
Creates a newCacheConfiguration.Builder
for aCacheConfiguration
, which uses thestorageManager
as a backing store.static <K, V> CacheConfiguration.Builder<K,V>
Builder(Class<K> keyType, Class<V> valueType, URI uri, String cacheName, EmbeddedStorageManager storageManager)
Creates a newCacheConfiguration.Builder
for aCacheConfiguration
, which uses thestorageManager
as a backing store.static <K, V> CacheConfiguration.Builder<K,V>
Builder(Class<K> keyType, Class<V> valueType, Configuration configuration)
Creates a newCacheConfiguration.Builder
for aCacheConfiguration
, which uses the generic MicroStreamconfiguration
's values.static CacheConfiguration.Builder<?,?>
Builder(Configuration configuration)
Creates a newCacheConfiguration.Builder
for aCacheConfiguration
, which uses the generic MicroStreamconfiguration
's values.static <K, V> javax.cache.configuration.Factory<EvictionManager<K,V>>
DefaultEvictionManagerFactory()
Returns the defaultEvictionManager
Factory
, which doesn't evict at all.static javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy>
DefaultExpiryPolicyFactory()
Returns the defaultExpiryPolicy
Factory
, which is eternal.static String
DefaultResourceName()
The default name of the cache configuration resource.static Predicate<? super Field>
DefaultSerializerFieldPredicate()
javax.cache.configuration.Factory<EvictionManager<K,V>>
getEvictionManagerFactory()
Gets theFactory
for theEvictionManager
, if any.Predicate<? super Field>
getSerializerFieldPredicate()
static CacheConfiguration<?,?>
load()
Tries to load the default configuration file.static CacheConfiguration<?,?>
load(File file)
Tries to load the configuration from the filefile
.static <K, V> CacheConfiguration<K,V>
load(File file, Class<K> keyType, Class<V> valueType)
Tries to load the configuration from the filefile
.static CacheConfiguration<?,?>
load(File file, Charset charset)
Tries to load the configuration from the filefile
.static <K, V> CacheConfiguration<K,V>
load(File file, Charset charset, Class<K> keyType, Class<V> valueType)
Tries to load the configuration from the filefile
.static CacheConfiguration<?,?>
load(InputStream inputStream)
Tries to load the configuration from theInputStream
inputStream
.static <K, V> CacheConfiguration<K,V>
load(InputStream inputStream, Class<K> keyType, Class<V> valueType)
Tries to load the configuration from theInputStream
inputStream
.static CacheConfiguration<?,?>
load(InputStream inputStream, Charset charset)
Tries to load the configuration from theInputStream
inputStream
.static <K, V> CacheConfiguration<K,V>
load(InputStream inputStream, Charset charset, Class<K> keyType, Class<V> valueType)
Tries to load the configuration from theInputStream
inputStream
.static <K, V> CacheConfiguration<K,V>
load(Class<K> keyType, Class<V> valueType)
Tries to load the default configuration file.static CacheConfiguration<?,?>
load(String path)
Tries to load the configuration file frompath
.static <K, V> CacheConfiguration<K,V>
load(String path, Class<K> keyType, Class<V> valueType)
Tries to load the configuration file frompath
.static CacheConfiguration<?,?>
load(String path, Charset charset)
Tries to load the configuration file frompath
.static <K, V> CacheConfiguration<K,V>
load(String path, Charset charset, Class<K> keyType, Class<V> valueType)
Tries to load the configuration file frompath
.static CacheConfiguration<?,?>
load(URL url)
Tries to load the configuration from the URLurl
.static <K, V> CacheConfiguration<K,V>
load(URL url, Class<K> keyType, Class<V> valueType)
Tries to load the configuration from the URLurl
.static CacheConfiguration<?,?>
load(URL url, Charset charset)
Tries to load the configuration from the URLurl
.static <K, V> CacheConfiguration<K,V>
load(URL url, Charset charset, Class<K> keyType, Class<V> valueType)
Tries to load the configuration from the URLurl
.static CacheConfiguration<?,?>
load(Charset charset)
Tries to load the default configuration file.static <K, V> CacheConfiguration<K,V>
load(Charset charset, Class<K> keyType, Class<V> valueType)
Tries to load the default configuration file.static CacheConfiguration<?,?>
load(Path path)
Tries to load the configuration frompath
.static <K, V> CacheConfiguration<K,V>
load(Path path, Class<K> keyType, Class<V> valueType)
Tries to load the configuration frompath
.static CacheConfiguration<?,?>
load(Path path, Charset charset)
Tries to load the configuration frompath
.static <K, V> CacheConfiguration<K,V>
load(Path path, Charset charset, Class<K> keyType, Class<V> valueType)
Tries to load the configuration frompath
.static CacheConfiguration<?,?>
Load()
Deprecated.replaced byload()
, will be removed in a future releasestatic CacheConfiguration<?,?>
Load(File file)
Deprecated.replaced byload(File)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(File file, Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(File,Class,Class)
, will be removed in a future releasestatic CacheConfiguration<?,?>
Load(File file, Charset charset)
Deprecated.replaced byload(File,Charset)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(File file, Charset charset, Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(File,Charset,Class,Class)
, will be removed in a future releasestatic CacheConfiguration<?,?>
Load(InputStream inputStream)
Deprecated.replaced byload(InputStream)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(InputStream inputStream, Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(InputStream,Class,Class)
, will be removed in a future releasestatic CacheConfiguration<?,?>
Load(InputStream inputStream, Charset charset)
Deprecated.replaced byload(InputStream,Charset)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(InputStream inputStream, Charset charset, Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(InputStream,Charset,Class,Class)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(Class,Class)
, will be removed in a future releasestatic CacheConfiguration<?,?>
Load(String path)
Deprecated.replaced byload(String)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(String path, Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(String,Class,Class)
, will be removed in a future releasestatic CacheConfiguration<?,?>
Load(String path, Charset charset)
Deprecated.replaced byload(String,Charset)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(String path, Charset charset, Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(String,Charset,Class,Class)
, will be removed in a future releasestatic CacheConfiguration<?,?>
Load(URL url)
Deprecated.replaced byload(URL)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(URL url, Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(URL,Class,Class)
, will be removed in a future releasestatic CacheConfiguration<?,?>
Load(URL url, Charset charset)
Deprecated.replaced byload(URL,Charset)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(URL url, Charset charset, Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(URL,Charset,Class,Class)
, will be removed in a future releasestatic CacheConfiguration<?,?>
Load(Charset charset)
Deprecated.replaced byload(Charset)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(Charset charset, Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(Charset,Class,Class)
, will be removed in a future releasestatic CacheConfiguration<?,?>
Load(Path path)
Deprecated.replaced byload(Path)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(Path path, Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(Path,Class,Class)
, will be removed in a future releasestatic CacheConfiguration<?,?>
Load(Path path, Charset charset)
Deprecated.replaced byload(Path,Charset)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
Load(Path path, Charset charset, Class<K> keyType, Class<V> valueType)
Deprecated.replaced byload(Path,Charset,Class,Class)
, will be removed in a future releasestatic <K, V> CacheConfiguration<K,V>
New(javax.cache.configuration.Configuration<K,V> other)
Creates a newCacheConfiguration
based on aConfiguration
.static String
PathProperty()
The property name which is used to hand the external configuration file path to the application.
-
Method Details
-
PathProperty
The property name which is used to hand the external configuration file path to the application.Either as system property or in the context's configuration, e.g. Spring's application.properties.
- Returns:
- "microstream.cache.configuration.path"
-
DefaultResourceName
The default name of the cache configuration resource.- Returns:
- "microstream-cache.properties"
- See Also:
load()
-
Load
Deprecated.replaced byload()
, will be removed in a future release -
load
Tries to load the default configuration file.The search order is as follows:
- The path set in the system property "microstream.cache.configuration.path"
- The file named "microstream-cache.properties" in
- The classpath
- The application's directory
- The user home directory
- Returns:
- the loaded configuration or
null
if none was found - See Also:
PathProperty()
,DefaultResourceName()
-
Load
Deprecated.replaced byload(Charset)
, will be removed in a future release -
load
Tries to load the default configuration file.The search order is as follows:
- The path set in the system property "microstream.cache.configuration.path"
- The file named "microstream-cache.properties" in
- The classpath
- The application's directory
- The user home directory
- Parameters:
charset
- the charset used to load the configuration- Returns:
- the loaded configuration or
null
if none was found - See Also:
PathProperty()
,DefaultResourceName()
-
Load
Deprecated.replaced byload(Class,Class)
, will be removed in a future release -
load
Tries to load the default configuration file.The search order is as follows:
- The path set in the system property "microstream.cache.configuration.path"
- The file named "microstream-cache.properties" in
- The classpath
- The application's directory
- The user home directory
- Parameters:
keyType
- the key typevalueType
- the value type- Returns:
- the loaded configuration or
null
if none was found - See Also:
PathProperty()
,DefaultResourceName()
-
Load
@Deprecated static <K, V> CacheConfiguration<K,V> Load(Charset charset, Class<K> keyType, Class<V> valueType)Deprecated.replaced byload(Charset,Class,Class)
, will be removed in a future release -
load
static <K, V> CacheConfiguration<K,V> load(Charset charset, Class<K> keyType, Class<V> valueType)Tries to load the default configuration file.The search order is as follows:
- The path set in the system property "microstream.cache.configuration.path"
- The file named "microstream-cache.properties" in
- The classpath
- The application's directory
- The user home directory
- Parameters:
charset
- the charset used to load the configurationkeyType
- the key typevalueType
- the value type- Returns:
- the loaded configuration or
null
if none was found - See Also:
PathProperty()
,DefaultResourceName()
-
Load
Deprecated.replaced byload(String)
, will be removed in a future release -
load
Tries to load the configuration file frompath
.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URL- Returns:
- the configuration or
null
if none was found
-
Load
Deprecated.replaced byload(String,Charset)
, will be removed in a future release -
load
Tries to load the configuration file frompath
.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URLcharset
- the charset used to load the configuration- Returns:
- the configuration or
null
if none was found
-
Load
@Deprecated static <K, V> CacheConfiguration<K,V> Load(String path, Class<K> keyType, Class<V> valueType)Deprecated.replaced byload(String,Class,Class)
, will be removed in a future release -
load
Tries to load the configuration file frompath
.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URLkeyType
- the key typevalueType
- the value type- Returns:
- the configuration or
null
if none was found
-
Load
@Deprecated static <K, V> CacheConfiguration<K,V> Load(String path, Charset charset, Class<K> keyType, Class<V> valueType)Deprecated.replaced byload(String,Charset,Class,Class)
, will be removed in a future release -
load
static <K, V> CacheConfiguration<K,V> load(String path, Charset charset, Class<K> keyType, Class<V> valueType)Tries to load the configuration file frompath
.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URLcharset
- the charset used to load the configurationkeyType
- the key typevalueType
- the value type- Returns:
- the configuration or
null
if none was found
-
Load
Deprecated.replaced byload(Path)
, will be removed in a future release -
load
Tries to load the configuration frompath
.- Parameters:
path
- file system path- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
Deprecated.replaced byload(Path,Charset)
, will be removed in a future release -
load
Tries to load the configuration frompath
.- Parameters:
path
- file system pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
Deprecated.replaced byload(File)
, will be removed in a future release -
load
Tries to load the configuration from the filefile
.- Parameters:
file
- file path- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
Deprecated.replaced byload(File,Charset)
, will be removed in a future release -
load
Tries to load the configuration from the filefile
.- Parameters:
file
- file pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
Deprecated.replaced byload(URL)
, will be removed in a future release -
load
Tries to load the configuration from the URLurl
.- Parameters:
url
- URL path- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
Deprecated.replaced byload(URL,Charset)
, will be removed in a future release -
load
Tries to load the configuration from the URLurl
.- Parameters:
url
- URL pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
Deprecated.replaced byload(InputStream)
, will be removed in a future release -
load
Tries to load the configuration from theInputStream
inputStream
.- Parameters:
inputStream
- the stream to read from- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
Deprecated.replaced byload(InputStream,Charset)
, will be removed in a future release -
load
Tries to load the configuration from theInputStream
inputStream
.- Parameters:
inputStream
- the stream to read fromcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
@Deprecated static <K, V> CacheConfiguration<K,V> Load(Path path, Class<K> keyType, Class<V> valueType)Deprecated.replaced byload(Path,Class,Class)
, will be removed in a future release -
load
Tries to load the configuration frompath
.- Parameters:
path
- file system pathkeyType
- the key typevalueType
- the value type- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
@Deprecated static <K, V> CacheConfiguration<K,V> Load(Path path, Charset charset, Class<K> keyType, Class<V> valueType)Deprecated.replaced byload(Path,Charset,Class,Class)
, will be removed in a future release -
load
static <K, V> CacheConfiguration<K,V> load(Path path, Charset charset, Class<K> keyType, Class<V> valueType)Tries to load the configuration frompath
.- Parameters:
path
- file system pathcharset
- the charset used to load the configurationkeyType
- the key typevalueType
- the value type- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
@Deprecated static <K, V> CacheConfiguration<K,V> Load(File file, Class<K> keyType, Class<V> valueType)Deprecated.replaced byload(File,Class,Class)
, will be removed in a future release -
load
Tries to load the configuration from the filefile
.- Parameters:
file
- file pathkeyType
- the key typevalueType
- the value type- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
@Deprecated static <K, V> CacheConfiguration<K,V> Load(File file, Charset charset, Class<K> keyType, Class<V> valueType)Deprecated.replaced byload(File,Charset,Class,Class)
, will be removed in a future release -
load
static <K, V> CacheConfiguration<K,V> load(File file, Charset charset, Class<K> keyType, Class<V> valueType)Tries to load the configuration from the filefile
.- Parameters:
file
- file pathcharset
- the charset used to load the configurationkeyType
- the key typevalueType
- the value type- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
@Deprecated static <K, V> CacheConfiguration<K,V> Load(URL url, Class<K> keyType, Class<V> valueType)Deprecated.replaced byload(URL,Class,Class)
, will be removed in a future release -
load
Tries to load the configuration from the URLurl
.- Parameters:
url
- URL pathkeyType
- the key typevalueType
- the value type- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
@Deprecated static <K, V> CacheConfiguration<K,V> Load(URL url, Charset charset, Class<K> keyType, Class<V> valueType)Deprecated.replaced byload(URL,Charset,Class,Class)
, will be removed in a future release -
load
static <K, V> CacheConfiguration<K,V> load(URL url, Charset charset, Class<K> keyType, Class<V> valueType)Tries to load the configuration from the URLurl
.- Parameters:
url
- URL pathcharset
- the charset used to load the configurationkeyType
- the key typevalueType
- the value type- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
@Deprecated static <K, V> CacheConfiguration<K,V> Load(InputStream inputStream, Class<K> keyType, Class<V> valueType)Deprecated.replaced byload(InputStream,Class,Class)
, will be removed in a future release -
load
static <K, V> CacheConfiguration<K,V> load(InputStream inputStream, Class<K> keyType, Class<V> valueType)Tries to load the configuration from theInputStream
inputStream
.- Parameters:
inputStream
- the stream to read fromkeyType
- the key typevalueType
- the value type- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
Load
@Deprecated static <K, V> CacheConfiguration<K,V> Load(InputStream inputStream, Charset charset, Class<K> keyType, Class<V> valueType)Deprecated.replaced byload(InputStream,Charset,Class,Class)
, will be removed in a future release -
load
static <K, V> CacheConfiguration<K,V> load(InputStream inputStream, Charset charset, Class<K> keyType, Class<V> valueType)Tries to load the configuration from theInputStream
inputStream
.- Parameters:
inputStream
- the stream to read fromcharset
- the charset used to load the configurationkeyType
- the key typevalueType
- the value type- Returns:
- the configuration
- Throws:
ConfigurationException
- if the configuration couldn't be loaded
-
getEvictionManagerFactory
javax.cache.configuration.Factory<EvictionManager<K,V>> getEvictionManagerFactory()Gets theFactory
for theEvictionManager
, if any.- Returns:
- the
Factory
for theEvictionManager
or null if none has been set.
-
getSerializerFieldPredicate
-
Builder
Creates a newCacheConfiguration.Builder
for aCacheConfiguration
.- Parameters:
keyType
- the key typevalueType
- the value type
-
Builder
static <K, V> CacheConfiguration.Builder<K,V> Builder(Class<K> keyType, Class<V> valueType, String cacheName, EmbeddedStorageManager storageManager)Creates a newCacheConfiguration.Builder
for aCacheConfiguration
, which uses thestorageManager
as a backing store.- Parameters:
keyType
- the key typevalueType
- the value typecacheName
- the slot name for the data in theEmbeddedStorageManager
's root, usually theCache
's namestorageManager
- theEmbeddedStorageManager
to use as a backing store
-
Builder
static <K, V> CacheConfiguration.Builder<K,V> Builder(Class<K> keyType, Class<V> valueType, URI uri, String cacheName, EmbeddedStorageManager storageManager)Creates a newCacheConfiguration.Builder
for aCacheConfiguration
, which uses thestorageManager
as a backing store.- Parameters:
keyType
- the key typevalueType
- the value typeuri
- prefix of the slot name for the data in theEmbeddedStorageManager
's rootcacheName
- suffix of slot name for the data in theEmbeddedStorageManager
's rootstorageManager
- theEmbeddedStorageManager
to use as a backing store
-
Builder
Creates a newCacheConfiguration.Builder
for aCacheConfiguration
, which uses the generic MicroStreamconfiguration
's values.- Parameters:
configuration
- theConfiguration
to take the initial values from
-
Builder
static <K, V> CacheConfiguration.Builder<K,V> Builder(Class<K> keyType, Class<V> valueType, Configuration configuration)Creates a newCacheConfiguration.Builder
for aCacheConfiguration
, which uses the generic MicroStreamconfiguration
's values.- Parameters:
keyType
- the key typevalueType
- the value typeconfiguration
- theConfiguration
to take the initial values from
-
DefaultExpiryPolicyFactory
static javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> DefaultExpiryPolicyFactory()Returns the defaultExpiryPolicy
Factory
, which is eternal. -
DefaultEvictionManagerFactory
static <K, V> javax.cache.configuration.Factory<EvictionManager<K,V>> DefaultEvictionManagerFactory()Returns the defaultEvictionManager
Factory
, which doesn't evict at all. -
DefaultSerializerFieldPredicate
-
New
Creates a newCacheConfiguration
based on aConfiguration
.
-