Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors the grc GORM cache plugin to use a clean, abstract cache interface and removes the direct dependency on go-redis. The documentation and examples are updated to reflect a backend-agnostic, pluggable architecture. Tests and example code now use SQLite and in-memory cache by default, making the project easier to use and test without external dependencies.
Major architectural changes:
The cache backend is now defined by a simple
CacheClientinterface, allowing users to implement any storage backend (memory, Redis, Memcached, file, etc.) and switch backends without changing application code. (README.md,cache.go) [1] [2]All direct usage of go-redis and related code has been removed from the core library and tests. Redis support is now optional via a separate, simple client implementation. (
cache.go,cache_test.go,example/main.go) [1] [2] [3]Documentation and examples:
The
README.mdis rewritten to highlight the new architecture, usage patterns, cache control, available implementations, migration guide, and contribution instructions. (README.md)Example code now uses SQLite and
MemoryCachefor demonstration, with Redis usage shown as an optional, commented-out section. (example/main.go,example/memory_example.go) [1] [2] [3]Testing improvements:
cache_test.go) [1] [2]Error handling and API consistency:
ErrCacheMisserror for cache misses, replacing backend-specific error handling. (cache.go) [1] [2]