Skip to content

Conversation

@tylerhutcherson
Copy link
Collaborator

@tylerhutcherson tylerhutcherson commented Jul 31, 2023

Enables TTL for loading data to Redis using RedisVL. This TTL is an optional kwarg for the underlying load function. This is particularly useful for clients and abstractions like SemanticCache that lean on Redis support for ephemeral data.

Also adds a clear method to the LLM cache class that invalidates all data from the cache, but does not disturb the index itself.

@codecov-commenter
Copy link

codecov-commenter commented Aug 1, 2023

Codecov Report

Merging #28 (04f0869) into main (dcc5297) will increase coverage by 0.50%.
The diff coverage is 90.32%.

@@            Coverage Diff             @@
##             main      #28      +/-   ##
==========================================
+ Coverage   88.05%   88.56%   +0.50%     
==========================================
  Files          11       11              
  Lines         536      551      +15     
==========================================
+ Hits          472      488      +16     
+ Misses         64       63       -1     
Files Changed Coverage Δ
redisvl/index.py 92.30% <88.88%> (+1.25%) ⬆️
redisvl/llmcache/semantic.py 88.15% <91.66%> (+1.20%) ⬆️
redisvl/llmcache/base.py 100.00% <100.00%> (ø)

@tylerhutcherson tylerhutcherson requested a review from Spartee August 1, 2023 18:19
@tylerhutcherson tylerhutcherson marked this pull request as ready for review August 1, 2023 18:19
Spartee
Spartee previously approved these changes Aug 1, 2023
Copy link
Contributor

@Spartee Spartee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments. Looks great.

redisvl/index.py Outdated
for record in data:
key = f"{self._prefix}:{self._get_key_field(record)}"
self._redis_conn.hset(key, mapping=record) # type: ignore
# TODO -- should we return a count of the upserts? or some kind of metadata?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo outside comments. these become docs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed!

Copy link
Contributor

@Spartee Spartee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tylerhutcherson tylerhutcherson merged commit 4c84ed4 into main Aug 2, 2023
@tylerhutcherson tylerhutcherson deleted the llmcache-ttl-configuration branch August 2, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants