PR back to optum#1
Open
Esity wants to merge 116 commits into
Open
Conversation
connection_pool >= 2.4, dalli >= 3.0, redis >= 5.0
- add cache_interface_spec.rb (15 tests for module API surface) - add version_spec.rb (3 tests) - expand settings_spec.rb (17 tests for defaults and driver selection) - expand pool_spec.rb (6 tests with included module pattern) - fix spec_helper load order (require settings before using it) - 42 unit tests that always pass without Memcached/Redis
runs after ci passes on push to main. calls reusable release workflow for version detection, github release, and rubygems publish.
dalli gem enforces a 1mb client-side size limit before sending to memcached. this prevented large cache values (e.g. 11k+ memory traces) from being stored even when the memcached server allows larger items. v1.2.1
- README: 8MB value_max_bytes default, pool API, driver usage examples - CLAUDE.md: memcached defaults, TTL signature differences
Also fix Local#restart to preserve local settings (namespace, etc.) by merging local_settings as the base before applying caller-supplied opts. Without this, restart dropped the legion_local namespace and wrote to the shared namespace, breaking isolation.
- refactor @connected to Concurrent::AtomicBoolean - invert call graph: set_sync/delete_sync own mutation logic - mset_sync holds mutex for atomic batch writes - add mget/mset/mset_sync for interface consistency - add exception handling on reads (get/fetch return nil) - add lifecycle rescue (setup/shutdown/restart force connected=false) - fix reset! race: make_false inside mutex before clearing store - add enforce_phi_ttl with minimum 1s clamp - add flush rescue returning false on error - add restart method
…improvements Phase A - adversarial review fixes: - force helper and cacheable to use async: false for read-after-write consistency - fix async writer TOCTOU race in enqueue (local executor reference) - add failed_count to async writer stats - fix reconnector deadlock, atomic reset, and missing require - add reconnect_shared! raising method, start reconnector on any shared failure - guard setup with enabled? check - make async writer and reconnector tier-aware for settings - apply serialization to redis mget/mset_sync, force binary encoding - pass auth/TLS options to redis cluster flush per-node connections - drain async writer before closing pools on shutdown Phase B - connection pool improvements: - remove hardcoded pool_size from redis driver, resolve from settings - separate pool checkout timeout from operation timeout - refactor state flags to Concurrent::AtomicBoolean for thread safety - add public pool accessor, replace direct @client access in redis_hash - add end-to-end lifecycle integration test - add automatic failback to local when shared cache unavailable - bump version to 1.4.1
apply post-optimization adversarial review fixes and pool improvements
Adds Legion::Cache.set_nx(key, value, ttl:) — a compare-and-set primitive that returns true if the key was written (race won) and false if the key already existed. - Redis: conn.set(key, serialized, nx: true, ex: ttl) - Memcached: conn.add(key, value, ttl) — native atomic add semantics - Memory: mutex-guarded check-and-set with TTL expiry awareness - Facade (Legion::Cache): routes to the active driver; falls back through local/memory tiers following the same pattern as set Specs cover: win/lose semantics, TTL expiry, concurrency (10 threads), serialization pass-through, and the public interface contract. Also fixes a pre-existing helper_spec JSON key assertion that broke when Legion::JSON.dump switched to pretty-print output.
Fleet WS-00G: add Legion::Cache.set_nx
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.
No description provided.