redis / redis-vl-python

Redis Vector Library (RedisVL) interfaces with Redis' vector database for realtime semantic search, RAG, and recommendation systems.
https://www.redisvl.com/
MIT License
210 stars 32 forks source link

How to hold / cache a SemanticCache instance? #159

Closed wired87 closed 1 month ago

wired87 commented 3 months ago

Hi, is there a way to hold a pre defined redis cache instance somewhere? I currently define everytime a request comes in a new one what takes way too loong. So there must be the apprich to hold it somehow? Everything i can think about is pickling it and save it but that sounds not right. What are your approaches?

rbs333 commented 3 months ago

Hi @wired87 one of these guide might help you out:

If you want to pre-populate the cache you can do this with an initialization script one time and the records will live on in the Redis instance. When you consume the cache you don't need to redefine just connect to it and you can cache.check() as you would.

tylerhutcherson commented 3 months ago

Also would be helpful to understand the runtime environment you are in here... is this a FastAPI service? Or a notebook? This will influence how you should load the caching instance