Skip to content

Reworks, refactors and tests#14

Open
IvanIvanoff wants to merge 9 commits intomasterfrom
bring-new-functionality
Open

Reworks, refactors and tests#14
IvanIvanoff wants to merge 9 commits intomasterfrom
bring-new-functionality

Conversation

@IvanIvanoff
Copy link
Copy Markdown
Owner

  • Add value compressing
  • Update dependencies
  • Add tests

@IvanIvanoff IvanIvanoff changed the title bring new functionality Compress values. Add tests Feb 17, 2026
@IvanIvanoff IvanIvanoff requested a review from Copilot February 17, 2026 21:43
Copy link
Copy Markdown

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 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
@IvanIvanoff IvanIvanoff force-pushed the bring-new-functionality branch from 2f26def to 8fb3a54 Compare February 17, 2026 22:54
@IvanIvanoff IvanIvanoff changed the title Compress values. Add tests Reworks, refactors and tests Feb 17, 2026
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.

2 participants