Interface CacheConfiguration<K,​V>

Type Parameters:
K - the key type
V - 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()
- getSerializerFoundation()

Can be adapted to MicroStream's generic Configuration layer.

  • Method Details

    • PathProperty

      static String 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

      static String DefaultResourceName()
      The default name of the cache configuration resource.
      Returns:
      "microstream-cache.properties"
      See Also:
      load()
    • Load

      @Deprecated static CacheConfiguration<?,​?> Load()
      Deprecated.
      replaced by load(), will be removed in version 8
      Returns:
      the loaded configuration or null if none was found
    • load

      static CacheConfiguration<?,​?> 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 static CacheConfiguration<?,​?> Load​(Charset charset)
      Deprecated.
      replaced by load(Charset), will be removed in version 8
      Parameters:
      charset - the charset used to load the configuration
      Returns:
      the loaded configuration or null if none was found
    • load

      static CacheConfiguration<?,​?> load​(Charset charset)
      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 static <K,​ V> CacheConfiguration<K,​V> Load​(Class<K> keyType, Class<V> valueType)
      Deprecated.
      replaced by load(Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the loaded configuration or null if none was found
    • load

      static <K,​ V> CacheConfiguration<K,​V> load​(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
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keyType - the class for the key type
      valueType - the class for 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 by load(Charset,Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      charset - the charset used to load the configuration
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the loaded configuration or null if none was found
    • 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
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      charset - the charset used to load the configuration
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the loaded configuration or null if none was found
      See Also:
      PathProperty(), DefaultResourceName()
    • Load

      @Deprecated static CacheConfiguration<?,​?> Load​(String path)
      Deprecated.
      replaced by load(String), will be removed in version 8
      Parameters:
      path - a classpath resource, a file path or an URL
      Returns:
      the configuration or null if none was found
    • load

      static CacheConfiguration<?,​?> load​(String path)
      Tries to load the configuration file from path.

      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 static CacheConfiguration<?,​?> Load​(String path, Charset charset)
      Deprecated.
      replaced by load(String,Charset), will be removed in version 8
      Parameters:
      path - a classpath resource, a file path or an URL
      charset - the charset used to load the configuration
      Returns:
      the configuration or null if none was found
    • load

      static CacheConfiguration<?,​?> load​(String path, Charset charset)
      Tries to load the configuration file from path.

      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
      charset - 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 by load(String,Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      path - a classpath resource, a file path or an URL
      keyType - the class of the key type
      valueType - the class of the value type
      Returns:
      the configuration or null if none was found
    • load

      static <K,​ V> CacheConfiguration<K,​V> load​(String path, Class<K> keyType, Class<V> valueType)
      Tries to load the configuration file from path.

      The load order is as follows:

      • The classpath
      • As an URL
      • As a file
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      path - a classpath resource, a file path or an URL
      keyType - the class of the key type
      valueType - the class of 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 by load(String,Charset,Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      path - a classpath resource, a file path or an URL
      charset - the charset used to load the configuration
      keyType - the class of the key type
      valueType - the class of the value type
      Returns:
      the configuration or null if none was found
    • load

      static <K,​ V> CacheConfiguration<K,​V> load​(String path, Charset charset, Class<K> keyType, Class<V> valueType)
      Tries to load the configuration file from path.

      The load order is as follows:

      • The classpath
      • As an URL
      • As a file
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      path - a classpath resource, a file path or an URL
      charset - the charset used to load the configuration
      keyType - the class of the key type
      valueType - the class of the value type
      Returns:
      the configuration or null if none was found
    • Load

      @Deprecated static CacheConfiguration<?,​?> Load​(Path path)
      Deprecated.
      replaced by load(Path), will be removed in version 8
      Parameters:
      path - file system path
      Returns:
      the configuration
    • load

      static CacheConfiguration<?,​?> load​(Path path)
      Tries to load the configuration from path.
      Parameters:
      path - file system path
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • Load

      @Deprecated static CacheConfiguration<?,​?> Load​(Path path, Charset charset)
      Deprecated.
      replaced by load(Path,Charset), will be removed in version 8
      Parameters:
      path - file system path
      charset - the charset used to load the configuration
      Returns:
      the configuration
    • load

      static CacheConfiguration<?,​?> load​(Path path, Charset charset)
      Tries to load the configuration from path.
      Parameters:
      path - file system path
      charset - the charset used to load the configuration
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • Load

      @Deprecated static CacheConfiguration<?,​?> Load​(File file)
      Deprecated.
      replaced by load(File), will be removed in version 8
      Parameters:
      file - file path
      Returns:
      the configuration
    • load

      static CacheConfiguration<?,​?> load​(File file)
      Tries to load the configuration from the file file.
      Parameters:
      file - file path
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • Load

      @Deprecated static CacheConfiguration<?,​?> Load​(File file, Charset charset)
      Deprecated.
      replaced by load(File,Charset), will be removed in version 8
      Parameters:
      file - file path
      charset - the charset used to load the configuration
      Returns:
      the configuration
    • load

      static CacheConfiguration<?,​?> load​(File file, Charset charset)
      Tries to load the configuration from the file file.
      Parameters:
      file - file path
      charset - the charset used to load the configuration
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • Load

      @Deprecated static CacheConfiguration<?,​?> Load​(URL url)
      Deprecated.
      replaced by load(URL), will be removed in version 8
      Parameters:
      url - URL path
      Returns:
      the configuration
    • load

      static CacheConfiguration<?,​?> load​(URL url)
      Tries to load the configuration from the URL url.
      Parameters:
      url - URL path
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • Load

      @Deprecated static CacheConfiguration<?,​?> Load​(URL url, Charset charset)
      Deprecated.
      replaced by load(URL,Charset), will be removed in version 8
      Parameters:
      url - URL path
      charset - the charset used to load the configuration
      Returns:
      the configuration
    • load

      static CacheConfiguration<?,​?> load​(URL url, Charset charset)
      Tries to load the configuration from the URL url.
      Parameters:
      url - URL path
      charset - the charset used to load the configuration
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • Load

      @Deprecated static CacheConfiguration<?,​?> Load​(InputStream inputStream)
      Deprecated.
      replaced by load(InputStream), will be removed in version 8
      Parameters:
      inputStream - the stream to read from
      Returns:
      the configuration
    • load

      static CacheConfiguration<?,​?> load​(InputStream inputStream)
      Tries to load the configuration from the InputStream inputStream.
      Parameters:
      inputStream - the stream to read from
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • Load

      @Deprecated static CacheConfiguration<?,​?> Load​(InputStream inputStream, Charset charset)
      Deprecated.
      replaced by load(InputStream,Charset), will be removed in version 8
      Parameters:
      inputStream - the stream to read from
      charset - the charset used to load the configuration
      Returns:
      the configuration
    • load

      static CacheConfiguration<?,​?> load​(InputStream inputStream, Charset charset)
      Tries to load the configuration from the InputStream inputStream.
      Parameters:
      inputStream - the stream to read from
      charset - 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 by load(Path,Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      path - file system path
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the configuration
    • load

      static <K,​ V> CacheConfiguration<K,​V> load​(Path path, Class<K> keyType, Class<V> valueType)
      Tries to load the configuration from path.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      path - file system path
      keyType - the class for the key type
      valueType - the class for 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 by load(Path,Charset,Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      path - file system path
      charset - the charset used to load the configuration
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the configuration
    • load

      static <K,​ V> CacheConfiguration<K,​V> load​(Path path, Charset charset, Class<K> keyType, Class<V> valueType)
      Tries to load the configuration from path.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      path - file system path
      charset - the charset used to load the configuration
      keyType - the class for the key type
      valueType - the class for 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 by load(File,Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      file - file path
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the configuration
    • load

      static <K,​ V> CacheConfiguration<K,​V> load​(File file, Class<K> keyType, Class<V> valueType)
      Tries to load the configuration from the file file.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      file - file path
      keyType - the class for the key type
      valueType - the class for 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 by load(File,Charset,Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      file - file path
      charset - the charset used to load the configuration
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the configuration
    • 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 file file.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      file - file path
      charset - the charset used to load the configuration
      keyType - the class for the key type
      valueType - the class for 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 by load(URL,Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      url - URL path
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the configuration
    • load

      static <K,​ V> CacheConfiguration<K,​V> load​(URL url, Class<K> keyType, Class<V> valueType)
      Tries to load the configuration from the URL url.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      url - URL path
      keyType - the class for the key type
      valueType - the class for 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 by load(URL,Charset,Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      url - URL path
      charset - the charset used to load the configuration
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the configuration
    • 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 URL url.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      url - URL path
      charset - the charset used to load the configuration
      keyType - the class for the key type
      valueType - the class for 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 by load(InputStream,Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      inputStream - the stream to read from
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the configuration
    • load

      static <K,​ V> CacheConfiguration<K,​V> load​(InputStream inputStream, Class<K> keyType, Class<V> valueType)
      Tries to load the configuration from the InputStream inputStream.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      inputStream - the stream to read from
      keyType - the class for the key type
      valueType - the class for 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 by load(InputStream,Charset,Class,Class), will be removed in version 8
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      inputStream - the stream to read from
      charset - the charset used to load the configuration
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the configuration
    • load

      static <K,​ V> CacheConfiguration<K,​V> load​(InputStream inputStream, Charset charset, Class<K> keyType, Class<V> valueType)
      Tries to load the configuration from the InputStream inputStream.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      inputStream - the stream to read from
      charset - the charset used to load the configuration
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the configuration
      Throws:
      ConfigurationException - if the configuration couldn't be loaded
    • getEvictionManagerFactory

      javax.cache.configuration.Factory<EvictionManager<K,​V>> getEvictionManagerFactory()
      Gets the Factory for the EvictionManager, if any.
      Returns:
      the Factory for the EvictionManager or null if none has been set.
    • getSerializerFoundation

      SerializerFoundation<?> getSerializerFoundation()
      Gets the serializer foundation.
      Returns:
      the foundation which the serializer will be based on
    • Builder

      static <K,​ V> CacheConfiguration.Builder<K,​V> Builder​(Class<K> keyType, Class<V> valueType)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keyType - the class for the key type
      valueType - the class for value type
      Returns:
      the newly created builder
    • Builder

      static <K,​ V> CacheConfiguration.Builder<K,​V> Builder​(Class<K> keyType, Class<V> valueType, String cacheName, EmbeddedStorageManager storageManager)
      Creates a new CacheConfiguration.Builder for a CacheConfiguration, which uses the storageManager as a backing store.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keyType - the class for the key type
      valueType - the class for value type
      cacheName - the slot name for the data in the EmbeddedStorageManager's root, usually the Cache's name
      storageManager - the EmbeddedStorageManager to use as a backing store
      Returns:
      the newly created builder
    • Builder

      static <K,​ V> CacheConfiguration.Builder<K,​V> Builder​(Class<K> keyType, Class<V> valueType, URI uri, String cacheName, EmbeddedStorageManager storageManager)
      Creates a new CacheConfiguration.Builder for a CacheConfiguration, which uses the storageManager as a backing store.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keyType - the class for the key type
      valueType - the class for value type
      uri - prefix of the slot name for the data in the EmbeddedStorageManager's root
      cacheName - suffix of slot name for the data in the EmbeddedStorageManager's root
      storageManager - the EmbeddedStorageManager to use as a backing store
      Returns:
      the newly created builder
    • Builder

      static CacheConfiguration.Builder<?,​?> Builder​(Configuration configuration)
      Creates a new CacheConfiguration.Builder for a CacheConfiguration, which uses the generic MicroStream configuration's values.
      Parameters:
      configuration - the Configuration to take the initial values from
      Returns:
      the newly created builder
    • Builder

      static <K,​ V> CacheConfiguration.Builder<K,​V> Builder​(Class<K> keyType, Class<V> valueType, Configuration configuration)
      Creates a new CacheConfiguration.Builder for a CacheConfiguration, which uses the generic MicroStream configuration's values.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keyType - the class for the key type
      valueType - the class for value type
      configuration - the Configuration to take the initial values from
      Returns:
      the newly created builder
    • DefaultExpiryPolicyFactory

      static javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> DefaultExpiryPolicyFactory()
      Returns:
      the default ExpiryPolicy Factory, which is eternal.
    • DefaultEvictionManagerFactory

      static <K,​ V> javax.cache.configuration.Factory<EvictionManager<K,​V>> DefaultEvictionManagerFactory()
      Type Parameters:
      K - the key type
      V - the value type
      Returns:
      the default EvictionManager Factory, which doesn't evict at all.
    • New

      static <K,​ V> CacheConfiguration<K,​V> New​(javax.cache.configuration.Configuration<K,​V> other)
      Creates a new CacheConfiguration based on a Configuration.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      other - the configuration to take the values from
      Returns:
      the newly created configuration