feat(integration): cache Stellar read queries#1206
Merged
Emmyt24 merged 4 commits intoMay 30, 2026
Conversation
- Implement EventReplayService with configurable ledger range replay - Support idempotent event processing from Stellar Horizon - Add automatic retry with exponential backoff for network failures - Implement dry-run mode for validation without persistence - Create admin routes for replay and clear-and-rebuild operations - Add comprehensive integration tests with mocked Horizon API - Document recovery procedures and best practices - Support cursor persistence for resumable recovery Features: - Replay events from specific ledger or stored cursor - Deterministic projection rebuilding from events - Graceful error handling with detailed error reporting - Batch processing with configurable size (1-200) - Network retry with exponential backoff - Dry-run validation mode - Clear and rebuild for complete recovery Fixes: Emmyt24#1163
- Implement StellarReadCache for in-memory caching of idempotent queries - Add configurable TTL (default: 30 seconds) - Support address-based cache invalidation on writes - Provide @CacheStellarRead decorator for read queries - Provide @InvalidateStellarCache decorator for write operations - Add cache key builder for consistent key generation - Support fresh reads to bypass cache when needed - Add comprehensive integration tests (15+ test cases) - Document cache configuration, usage, and best practices Features: - Cache hit/miss tracking - TTL-based expiration - Address-based invalidation - Manual cache management - Cache statistics and monitoring - Decorator-based caching for clean API Fixes: Emmyt24#1164
|
@wendypetersondev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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 #1164
Cache idempotent Stellar Horizon/RPC read queries with configurable TTL to reduce RPC load and latency, with correct invalidation on writes.
Closes #1164
Changes
Core Cache Implementation
Decorators for Clean API
@CacheStellarRead - Decorator for caching read queries
@InvalidateStellarCache - Decorator for invalidating on writes
Cache Key Builder
Integration Tests
Documentation
Key Features
✓ Configurable TTL for different query types
✓ Automatic TTL-based expiration
✓ Address-based cache invalidation
✓ Fresh read option to bypass cache
✓ Decorator-based caching for clean API
✓ Manual cache management
✓ Cache statistics and monitoring
✓ Comprehensive error handling
✓ No credential leakage
✓ Network failure resilience
Performance Impact
With 30-second TTL and typical 80% hit rate:
Usage Examples
Cache Read Queries
Invalidate on Writes
Manual Cache Management
Configuration
Environment Variables
Programmatic Configuration
Testing
Files Changed
Invalidation Rules
Address-Based Invalidation
When a write affects an address, all cache entries for that address are invalidated:
Full Cache Invalidation
For critical operations affecting multiple addresses:
Best Practices
Verification