Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Response Caching for Currency and Institution Endpoints #394

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

sundayonah
Copy link
Collaborator

@sundayonah sundayonah commented Jan 22, 2025

This PR implements Redis-based response caching for frequently accessed static data endpoints to improve API performance and reduce backend load.

Key Changes:

  • Added Redis cache middleware for /currencies, /institutions/:currency_code, and /pubkey endpoints
  • Implemented cache warming on server startup
  • Added cache hit/miss metrics using Prometheus
  • Added proper cache headers (Cache-Control, ETag) and handling
  • Implemented stale-while-revalidate pattern for high availability

Cache Configuration:

  • Currencies: 24 hours
  • Institutions by currency: 24 hours
  • Public key: 365 days

Cache Keys:

  • api:currencies:list
  • api:institutions:{currency_code}
  • api:aggregator:pubkey

Testing:

  • Added comprehensive test suite for cache middleware
  • Includes tests for cache hits, misses, and revalidation
  • Added benchmarks for cache performance

closes #381

@OnahProsperity
Copy link
Collaborator

This should be a draft pr right @sundayonah

@sundayonah
Copy link
Collaborator Author

This should be a draft pr right @sundayonah

Yes.

@sundayonah sundayonah force-pushed the implement-response-caching-for-currency-and-institution-endpoints branch from 9e07b06 to 3bb24ef Compare January 30, 2025 13:22
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.

Implement Response Caching for Currency and Institution Endpoints
2 participants