Class LangCacheSemanticCache.Builder

java.lang.Object
com.redis.vl.extensions.cache.LangCacheSemanticCache.Builder
Enclosing class:
LangCacheSemanticCache

public static class LangCacheSemanticCache.Builder extends Object
Builder for LangCacheSemanticCache.
  • 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

      public LangCacheSemanticCache.Builder serverUrl(String serverUrl)
      Set the LangCache server URL
      Parameters:
      serverUrl - Server URL
      Returns:
      This builder
    • cacheId

      public LangCacheSemanticCache.Builder cacheId(String cacheId)
      Set the LangCache cache ID
      Parameters:
      cacheId - Cache ID
      Returns:
      This builder
    • apiKey

      public LangCacheSemanticCache.Builder apiKey(String 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

      public LangCacheSemanticCache.Builder useExactSearch(boolean useExactSearch)
      Set whether to use exact search
      Parameters:
      useExactSearch - Whether to use exact matching
      Returns:
      This builder
    • useSemanticSearch

      public LangCacheSemanticCache.Builder useSemanticSearch(boolean useSemanticSearch)
      Set whether to use semantic search
      Parameters:
      useSemanticSearch - Whether to use semantic search
      Returns:
      This builder
    • distanceScale

      public LangCacheSemanticCache.Builder distanceScale(String distanceScale)
      Set the distance scale for distance thresholds
      Parameters:
      distanceScale - Either "normalized" (0-1) or "redis" (0-2 COSINE)
      Returns:
      This builder
    • httpClient

      public LangCacheSemanticCache.Builder httpClient(okhttp3.OkHttpClient httpClient)
      Set the HTTP client (primarily for testing)
      Parameters:
      httpClient - OkHttp client
      Returns:
      This builder
    • build

      public LangCacheSemanticCache build()
      Build the LangCacheSemanticCache
      Returns:
      LangCacheSemanticCache instance