Class SemanticCacheAdvisor.Builder
java.lang.Object
org.springframework.ai.chat.cache.semantic.SemanticCacheAdvisor.Builder
- Enclosing class:
- SemanticCacheAdvisor
Builder class for creating SemanticCacheAdvisor instances. Provides a fluent API
for configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and returns a new SemanticCacheAdvisor instance.cache(SemanticCache cache) Sets the semantic cache implementation.order(int order) Sets the advisor order.scheduler(reactor.core.scheduler.Scheduler scheduler) Sets the scheduler for async operations.scopeResolver(SemanticCacheScopeResolver scopeResolver) Sets the resolver of the scope that isolates cached responses.Sets the time-to-live of cached responses.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
cache
Sets the semantic cache implementation.- Parameters:
cache- The cache implementation to use- Returns:
- This builder instance
-
scopeResolver
Sets the resolver of the scope that isolates cached responses. Mandatory.- Parameters:
scopeResolver- The scope resolver to use- Returns:
- This builder instance
- Since:
- 2.0.2
-
order
Sets the advisor order.- Parameters:
order- The order value for this advisor- Returns:
- This builder instance
-
scheduler
Sets the scheduler for async operations.- Parameters:
scheduler- The scheduler to use- Returns:
- This builder instance
-
ttl
Sets the time-to-live of cached responses. By default, cached responses never expire.- Parameters:
ttl- The time-to-live of cached responses- Returns:
- This builder instance
- Since:
- 2.0.2
-
build
Builds and returns a new SemanticCacheAdvisor instance.- Returns:
- A new SemanticCacheAdvisor configured with this builder's settings
-