Class CacheConfigBuilder

  • All Implemented Interfaces:

    
    public final class CacheConfigBuilder<K extends Object, V extends Object>
    
                        

    DSL wrapper for CacheConfig.Builder providing a Kotlin-idiomatic configuration experience.

    This class wraps the Java CacheConfig.Builder and provides a cleaner, more Kotlin-like interface for configuring cache settings. It supports all the same configuration options as the underlying Java builder but with improved syntax and type safety.

    val config = cacheConfig<String, User> {
        // All configuration methods are available here
        maximumSize(1000L)
        expireAfterWrite(Duration.ofMinutes(30))
        // ... other configuration options
    }
    • Size Limits: maximumSize(), maximumWeight(), weigher()

    • Expiration: expireAfterWrite(), expireAfterAccess(), refreshAfterWrite()

    • Loading: loader(), asyncLoader()

    • Eviction: evictionStrategy()

    • References: weakKeys(), weakValues(), softValues()

    • Performance: initialCapacity(), concurrencyLevel(), recordStats()

    • Events: listener()

    • Storage: directory()