Package com.redis.vl.extensions.cache
Class LangCacheSemanticCache.Builder
java.lang.Object
com.redis.vl.extensions.cache.LangCacheSemanticCache.Builder
- Enclosing class:
LangCacheSemanticCache
Builder for LangCacheSemanticCache.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSet the LangCache API keybuild()Build the LangCacheSemanticCacheSet the LangCache cache IDdistanceScale(String distanceScale) Set the distance scale for distance thresholdshttpClient(okhttp3.OkHttpClient httpClient) Set the HTTP client (primarily for testing)Set the cache nameSet the LangCache server URLSet the TTL for cache entriesuseExactSearch(boolean useExactSearch) Set whether to use exact searchuseSemanticSearch(boolean useSemanticSearch) Set whether to use semantic search
-
Constructor Details
-
Builder
public Builder()Create a new Builder instance
-
-
Method Details
-
name
Set the cache name- Parameters:
name- Cache name- Returns:
- This builder
-
serverUrl
Set the LangCache server URL- Parameters:
serverUrl- Server URL- Returns:
- This builder
-
cacheId
Set the LangCache cache ID- Parameters:
cacheId- Cache ID- Returns:
- This builder
-
apiKey
Set the LangCache API key- Parameters:
apiKey- API key- Returns:
- This builder
-
ttl
Set the TTL for cache entries- Parameters:
ttl- Time-to-live in seconds- Returns:
- This builder
-
useExactSearch
Set whether to use exact search- Parameters:
useExactSearch- Whether to use exact matching- Returns:
- This builder
-
useSemanticSearch
Set whether to use semantic search- Parameters:
useSemanticSearch- Whether to use semantic search- Returns:
- This builder
-
distanceScale
Set the distance scale for distance thresholds- Parameters:
distanceScale- Either "normalized" (0-1) or "redis" (0-2 COSINE)- Returns:
- This builder
-
httpClient
Set the HTTP client (primarily for testing)- Parameters:
httpClient- OkHttp client- Returns:
- This builder
-
build
Build the LangCacheSemanticCache- Returns:
- LangCacheSemanticCache instance
-