Redis Linker
Redis Linker Class Documentation
Overview
The RedisLinker
class is a singleton class that manages Redis. It is used to link database and passage IDs that are stored in retrievals. The class is part of the RAGchain project and is located in the RAGchain/utils/linker/redis_linker.py
file.
The class inherits from the BaseLinker class and implements the put_json
, get_json
, and flush_db
abstract methods. It also includes additional methods such as connection_check
and __del__
.
The 'RedisLinker' class uses the redis Python library to interact with a Redis database. It requires several environment variables to be set, including REDIS_HOST
, REDIS_PORT
, REDIS_DB_NAME
, and REDIS_PW
.
Redis DB?
Redis database provides high performance and in-memory data storage, making it an excellent choice for this use case. Its key-value data model allows for quick and efficient retrieval of data, optimizing the retrieval process.
Usage
To use the RedisLinker class, you first need to set the required environment variables. These include LINKER_TYPE
, REDIS_HOST
, REDIS_PORT
, REDIS_DB_NAME
, and REDIS_PW
.
Here is an example of how to use the RedisLinker
class:
Please note that the put_json
method requires a unique ID and a JSON data as parameters. The get_json
method requires a list of IDs as a parameter. The flush_db
method does not require any parameters.
Last updated