Package com.redis.vl.extensions.cache
Class CacheHit
java.lang.Object
com.redis.vl.extensions.cache.CacheHit
Represents a cache hit from SemanticCache. Contains the matched response and metadata about the
match.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
Get the vector distance.Get the metadata.Get the matched prompt.Get the cached response.toString()
-
Constructor Details
-
CacheHit
Creates a new CacheHit.- Parameters:
prompt
- The original prompt that was matchedresponse
- The cached responsedistance
- The vector distance from the querymetadata
- Additional metadata stored with the cache entry
-
-
Method Details
-
getPrompt
Get the matched prompt.- Returns:
- The prompt
-
getResponse
Get the cached response.- Returns:
- The response
-
getDistance
public float getDistance()Get the vector distance.- Returns:
- The distance (0 = exact match, higher = less similar)
-
getMetadata
Get the metadata.- Returns:
- An unmodifiable view of the metadata map
-
toString
-