Class JCacheXProperties


  • @ConfigurationProperties(prefix="jcachex")
    public class JCacheXProperties
    extends Object
    Configuration properties for JCacheX in Spring Boot applications. This class provides type-safe configuration binding for JCacheX cache settings through Spring Boot's configuration properties mechanism. It allows you to configure cache behavior through application.yml, application.properties, or environment variables.

    Application Properties Examples:

    YAML Configuration:

    
     jcachex:
       default:
         maximumSize: 1000
         expireAfterSeconds: 1800  # 30 minutes
         enableStatistics: true
         enableJmx: false
       caches:
         users:
           maximumSize: 5000
           expireAfterSeconds: 3600  # 1 hour
           enableStatistics: true
           enableJmx: true
         sessions:
           maximumSize: 10000
           expireAfterSeconds: 1800  # 30 minutes
           enableStatistics: false
         apiResponses:
           maximumSize: 2000
           expireAfterSeconds: 300   # 5 minutes
           enableStatistics: true
     

    Properties File Configuration:

    
     # Default cache configuration
     jcachex.default.maximumSize=1000
     jcachex.default.expireAfterSeconds=1800
     jcachex.default.enableStatistics=true
     jcachex.default.enableJmx=false
    
     # Named cache configurations
     jcachex.caches.users.maximumSize=5000
     jcachex.caches.users.expireAfterSeconds=3600
     jcachex.caches.users.enableStatistics=true
    
     jcachex.caches.sessions.maximumSize=10000
     jcachex.caches.sessions.expireAfterSeconds=1800
     jcachex.caches.sessions.enableStatistics=false
     
    Since:
    1.0.0
    • Constructor Detail

      • JCacheXProperties

        public JCacheXProperties()
    • Method Detail

      • getDefault

        public JCacheXProperties.CacheConfig getDefault()
        Gets the default configuration using the property name "default". This enables property binding for "jcachex.default.*" properties.
        Returns:
        the default cache configuration
      • setDefault

        public void setDefault​(JCacheXProperties.CacheConfig defaultConfig)
        Sets the default configuration using the property name "default". This enables property binding for "jcachex.default.*" properties.
        Parameters:
        defaultConfig - the default cache configuration
      • isEnabled

        public boolean isEnabled()
      • setEnabled

        public void setEnabled​(boolean enabled)
      • isAutoCreateCaches

        public boolean isAutoCreateCaches()
      • setAutoCreateCaches

        public void setAutoCreateCaches​(boolean autoCreateCaches)