#632·GPTCache

[Enhancement]: Remove vector data when the corresponding cache data expires in cache storage

Author: LaarryliuCreated Jul 11, 2024Updated Nov 4, 2024

What would you like to be added?

In adapter.py line 108, when trying to search for data in cache store according to vector data:

python
for search_data in search_data_list:
            cache_data = time_cal(
                chat_cache.data_manager.get_scalar_data,
                func_name="get_data",
                report_func=chat_cache.report.data,
            )(
                search_data,
                extra_param=context.get("get_scalar_data", None),
                session=session,
            )
            if cache_data is None:
                continue

here, if cache_data is None means no data in cache store could be found with data from vector store. Is it better to remove the corresponding data from vector store to avoid hit it again?

Why is this needed?

Since the data in cache store is no longer available (maybe due to a cache ttl strategy, etc.), removing vector data is necessary so that the expired cache data will no longer be accessed.

Anything else?

Please correct me if I missed some details