Skip to content

feat(api): add TTL cache for escrow read endpoint#88

Open
okekefrancis112 wants to merge 6 commits intoLiquifact:mainfrom
okekefrancis112:escrow
Open

feat(api): add TTL cache for escrow read endpoint#88
okekefrancis112 wants to merge 6 commits intoLiquifact:mainfrom
okekefrancis112:escrow

Conversation

@okekefrancis112
Copy link
Copy Markdown

@okekefrancis112 okekefrancis112 commented Mar 27, 2026

Summary

Closes #27

  • Add MemoryCacheStore abstraction (src/services/cacheStore.js) backed by native Map with TTL-based lazy eviction, designed for future Redis swap-in
  • Add cacheResponse Express middleware (src/middleware/cache.js) that intercepts res.json() to cache 2xx responses, sets X-Cache: HIT/MISS headers, and transparently falls through on cache errors
  • Add cache config (src/config/cache.js) parsing ESCROW_CACHE_TTL_SECONDS env var (default: 30s)
  • Wire middleware onto GET /api/escrow/:invoiceId route
  • No new npm dependencies — uses native Map

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@okekefrancis112 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! 🚀

Learn more about application limits

npm ci was failing because the lockfile was missing entries for
jsonwebtoken and its transitive dependencies.
@mikewheeleer
Copy link
Copy Markdown
Contributor

Resolve the conflicts & revert the changes in package-lock.json

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.

Add Escrow Cache Layer with TTL

2 participants