Repository navigation
CacheLayer: Prometheus metrics, query optimizations, invalidation & warmup - #828
Merged
usmanimamu17-create merged 3 commits intoOct 23, 2026
Conversation
…eLayer Closes ApexChainx#770 Closes ApexChainx#771 Closes #1372 Closes #1415 ApexChainx#770: Add Prometheus metrics to all CacheLayer components (WalletCache, SLACache, TTLCache) including hit/miss/total counters, operation timers, error counters, and size gauges. ApexChainx#771: Optimize database queries by adding batch lookup in WalletRepository.get_by_user_id_or_public_key() and using it in WalletRegistry.link_wallet() to reduce two round-trips to one. #1372: Add cache invalidation propagation — SLACache.invalidate_by_device() uses SCAN-based deletion to remove all entries for a device at once. #1415: Add cache warmup support — WalletCache.warmup(), SLACache.warmup(), and TTLCache.warmup() for bulk pre-population after deployments or flushes. Co-authored-by: NickiM84 <noreply@github.com>
usmanimamu17-create
approved these changes
Oct 23, 2026
usmanimamu17-create
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me — merging. Thanks!
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.
Closes #770
Closes #771
Summary
Implements 4 Stellar Wave Program issues assigned to @NickiM84 targeting the CacheLayer:
-#770 – Add Prometheus metrics to CacheLayer: hit/miss/total counters, operation timers, error counters, and size gauges on
WalletCache,SLACache, andTTLCache.-#771 – Optimize database queries used by CacheLayer: added
WalletRepository.get_by_user_id_or_public_key()batch query and wired it intoWalletRegistry.link_wallet()to collapse two DB round-trips into one for conflict detection.Test plan
-[]
pytest tests/test_cache_layer.py -vpasses (28 tests covering metrics, warmup, invalidation, batch query)-[] Manual: verify /metrics/prometheus endpoint exposes
cache_wallet_*,cache_sla_*,cache_inprocess_*metrics-[] Manual: verify
get_by_user_id_or_public_keyreduces DB round-trips in link flow