LooPR
/
ecommerce-platform
/
contracts
/
currency-cache
DEMO
Currency Rate Caching
Cache currency exchange rates used during checkout.
● ACTIVE CONTRACT
Requirements
✓
Reuse RedisStore
✓
Use retry/backoff logic
✓
Preserve checkout compatibility
✓
Handle cache failures gracefully
Architecture Rules
ADR-008
Use the shared cache abstraction.
ADR-012
Do not instantiate Redis clients inside services.
Required Dependencies
pkg/cache/redis_store
pkg/network/backoff
Forbidden Patterns
new Redis(
createClient(
new RedisClient(
new IORedis(
Expected Interfaces
getRate(from: string, to: string): Promise<ExchangeRate>
Existing checkout consumers must remain compatible.
Edge Cases
•
Cache unavailable
•
External API timeout
•
Rate provider failure
•
Invalid currency
•
Cache expiration
Architecture Diagram
PaymentProcessor
↓
CurrencyService
↓
RedisStore
↓
Shared Cache
CurrencyService
↓
withBackoff()
↓
External Rate Provider
Review PR Against Contract
View Pull Requests