Open
Conversation
Owner
IvanIvanoff
commented
Feb 17, 2026
- Add value compressing
- Update dependencies
- Add tests
There was a problem hiding this comment.
Pull request overview
This PR adds value compression to the CachexProvider, updates dependencies to newer versions, and adds comprehensive test coverage for the caching layer. The changes aim to reduce memory usage through gzip compression and improve cache key generation to address potential locking issues.
Changes:
- Added gzip compression/decompression for cached values in CachexProvider
- Updated major dependencies (con_cache 0.14→1.1.1, absinthe 1.4→1.9.0, plug 1.8→1.19)
- Enhanced cache key generation with time-based bucketing to mitigate thundering herd and lock release issues
- Added comprehensive test suites for ConCacheProvider, cache key generation, and AbsintheCache functionality
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| test/support/case.ex | Updated test case template to allow configurable async option and changed from use to import for Plug modules |
| test/con_cache_provider_test.exs | Added comprehensive test suite for ConCacheProvider covering all operations including concurrent access scenarios |
| test/cache_key_test.exs | Added tests for cache key generation logic including TTL handling, bucketing, and struct conversion |
| test/absinthe_cache_test.exs | Expanded test coverage for cache_resolve macro, wrap function, and cache operations |
| mix.lock | Updated all dependencies to newer versions with significant updates to absinthe, con_cache, and plug |
| mix.exs | Loosened version constraints for con_cache and inflex dependencies |
| lib/cachex_cache_provider/cachex_cache_provider.ex | Implemented gzip compression for cached values and removed {:stored, value} wrapper |
| lib/before_send.ex | Added get_cache_key helper to support dynamic TTL modification from caching_params |
| lib/absinthe_cache.ex | Added time-based bucketing to cache keys, added count() API, and fixed size() signature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix Cachex provider {:nocache, ...} to set :do_not_cache_query (matching ConCache behavior)
- Fix silent TTL cap in ConCache provider: clamp instead of falling through to wrong clause
- Fix typo @max_ttl_ffset -> @max_ttl_offset in DocumentProvider
- Add [:safe] to :erlang.binary_to_term in Cachex provider to prevent atom exhaustion
- Guard against missing query_cache_key in BeforeSend to prevent crashes
- Remove dead cache_key_from_params/2 function from DocumentProvider
- Remove unused test/test_schema.ex (had wrong arity resolver)
- Remove unused require Logger from absinthe_cache.ex
- Remove @compile inline directives from all modules for better stack traces
- Use :ets.info(:size) for O(1) count instead of tab2list + length
- Use :ets.first/:ets.next iteration for clear_all instead of tab2list
- Replace Enum.max([x, 1]) with Kernel.max/2
- Fix clear_all/1 to return :ok (matching Behaviour contract) - Fix Enum.min -> min in Cachex provider backoff - Remove misleading _ prefix from size/1 return value - Remove outdated "Slow." from clear_all doc - Remove unused size_type type from Behaviour - Remove no-op terminate/2 from Unlocker GenServer - Fix typos: Middlewar -> Middleware, honor_do_no -> honor_do_not, datetiems -> datetimes - Rewrite incomplete Unlocker moduledoc
- Make cache_name, cache_provider, ttl, and max_ttl_offset configurable via application env (config :absinthe_cache) - Make context_cache_key configurable in DocumentProvider and BeforeSend - Remove dead :has_nocache_field process dict writes from both providers - Rename :do_not_cache_query to :__do_not_cache_query__ for consistency - Document process dictionary keys and configuration in moduledoc
- Add configuration_test.exs: test cache_name, ttl, max_ttl_offset, and cache_provider all work via Application.put_env - Add store/get edge cases: 2-arg store, error/nocache ignored, overwrite - Add get_or_store/2 tests: caching on miss, errors not cached - Add ConCacheProvider edge cases: TTL clamping, tuple key get_or_store, overwrite, clear_all return value
2f26def to
8fb3a54
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.