Skip to content

Conversation

@molon
Copy link
Collaborator

@molon molon commented Nov 27, 2025

xRef:

Copilot AI review requested due to automatic review settings November 27, 2025 09:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds transaction support to the GORMCache implementation, allowing cache operations to participate in database transactions. The changes enable transactional cache operations that can be committed or rolled back atomically with other database operations.

Key changes:

  • Added context-based transaction support with WithGORMTx and GetGORMTx helper functions
  • Modified all GORM cache methods (Migrate, Set, Get, Del) to support optional transactions via context
  • Added comprehensive test coverage for transaction commit, rollback, isolation, and delete scenarios

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
gorm.go Implements transaction support using context pattern with cmp.Or fallback for all cache operations
gorm_test.go Updates test helper to return DB instance and adds four comprehensive transaction tests
ristretto_test.go Simplifies type parameter usage in test helper by relying on type inference
client_test.go Updates test to accommodate new test helper signature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@molon molon merged commit 08ba676 into main Nov 27, 2025
1 check passed
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.

3 participants