Skip to content

Conversation

@kxbnb
Copy link

@kxbnb kxbnb commented Jan 10, 2026

Summary

Add automatic cleanup of vector data when corresponding cache data expires to fix orphaned vectors in Redis TTL scenarios.

Changes

  • Modified gptcache/adapter/adapter.py in both adapt() and aadapt() functions
  • Added chat_cache.data_manager.v.delete([search_data[1]]) when cache_data is None

Validation

  • Code compiles without syntax errors
  • Existing unit tests pass (except unrelated faiss dependency issue)
  • Added automated test test_vector_cleanup_on_expired_cache to verify the fix

Testing

  • Manual verification of logic implementation
  • New test ensures vector cleanup occurs when scalar data is missing
  • No breaking changes to existing functionality

Closes #632

@sre-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kxbnb
To complete the pull request process, please assign xiaofan-luan after the PR has been reviewed.
You can assign the PR to them by writing /assign @xiaofan-luan in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sre-ci-robot
Copy link
Collaborator

Welcome @kxbnb! It looks like this is your first PR to zilliztech/GPTCache 🎉

emmanuel-ferdman and others added 5 commits January 10, 2026 12:04
…been added (zilliztech#669)

I think that using LLM for verification can yield better results in some cases where quality requirements are higher. Especially in the customer service field and the like, other users' questions may lead to privacy leaks or mention other brands, thus causing interference and so on.

In terms of specific details, I maintained the operation of openai==0.28.0 on the interface and was compatible with the operation of openai>1.0.0 and above.

I have added the test case, the example test file, and updated the example/readme.md.

I upgraded the version of onnxruntime to 1.21.1 because the previous version 1.14.0 is no longer in use.

Signed-off-by: karthik <[email protected]>
- Add logic in adapt() and aadapt() to delete vector data when get_scalar_data returns None
- Addresses issue zilliztech#632 for cleaning up orphaned vector data in Redis TTL scenarios
- Ensures consistency between scalar and vector stores

Signed-off-by: karthik <[email protected]>
- Added test_vector_cleanup_on_expired_cache to verify issue zilliztech#632 fix
- Mocks data manager to simulate vector data without scalar data
- Ensures v.delete() is called when cache_data is None

Signed-off-by: karthik <[email protected]>
@kxbnb kxbnb force-pushed the feature/remove-expired-vector-data branch from 0bd2ecf to 1b0e8ac Compare January 10, 2026 17:04
@mergify mergify bot added dco-passed and removed needs-dco labels Jan 10, 2026
@kxbnb
Copy link
Author

kxbnb commented Jan 21, 2026

/assign @xiaofan-luan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants