Class CacheAutoConfiguration.ConfigurationFactory
java.lang.Object
cloud.opencode.base.cache.spring.CacheAutoConfiguration.ConfigurationFactory
- Enclosing class:
CacheAutoConfiguration
Configuration factory for manual Spring integration
用于手动 Spring 集成的配置工厂
Example usage in Spring configuration:
@Configuration
@EnableCaching
public class CacheConfiguration {
@Bean
@ConfigurationProperties(prefix = "opencode.cache")
public CacheProperties cacheProperties() {
return new CacheProperties();
}
@Bean
public CacheManager cacheManager(CacheProperties properties) {
return CacheAutoConfiguration.createCacheManager(properties);
}
}
- Since:
- JDK 25, opencode-base-cache V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ConfigurationFactory instance | 创建新的配置工厂实例 -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenCodeCacheManagercreate(Consumer<CacheProperties> configurer) Create cache manager with programmatic configuration 使用编程配置创建缓存管理器static OpenCodeCacheManagercreateSimple(long maximumSize, Duration expireAfterWrite) Create simple cache manager with basic settings 使用基本设置创建简单缓存管理器static OpenCodeCacheManagercreateWithCaches(String... cacheNames) Create cache manager with named caches 创建带命名缓存的缓存管理器
-
Constructor Details
-
ConfigurationFactory
public ConfigurationFactory()Creates a new ConfigurationFactory instance | 创建新的配置工厂实例
-
-
Method Details
-
create
Create cache manager with programmatic configuration 使用编程配置创建缓存管理器- Parameters:
configurer- configuration consumer | 配置消费者- Returns:
- cache manager | 缓存管理器
-
createSimple
Create simple cache manager with basic settings 使用基本设置创建简单缓存管理器- Parameters:
maximumSize- maximum entries per cache | 每个缓存的最大条目数expireAfterWrite- expire after write duration | 写入后过期时间- Returns:
- cache manager | 缓存管理器
-
createWithCaches
Create cache manager with named caches 创建带命名缓存的缓存管理器- Parameters:
cacheNames- cache names to pre-create | 要预创建的缓存名称- Returns:
- cache manager | 缓存管理器
-