Add subscription status cache with TTL in src/billing/cache.ts #1408

Open
opened 2026-04-13 17:34:39 -04:00 by pook · 0 comments
Owner

Reduce redundant Stripe API calls by caching subscription status. Create src/billing/cache.ts:

  • Export getSubscriptionStatus(userId: string) that checks in-memory Map cache first
  • If cache miss or expired (5-min TTL), query Stripe and cache result
  • Return { active: boolean, plan: string, currentPeriodEnd: number }
  • Export invalidateCache(userId) for use after webhook events update subscription state

Acceptance: Cache module created with unit tests for TTL expiry and invalidation.


Generated by CEO Planner (priority: 3)

Reduce redundant Stripe API calls by caching subscription status. Create src/billing/cache.ts: - Export getSubscriptionStatus(userId: string) that checks in-memory Map cache first - If cache miss or expired (5-min TTL), query Stripe and cache result - Return { active: boolean, plan: string, currentPeriodEnd: number } - Export invalidateCache(userId) for use after webhook events update subscription state Acceptance: Cache module created with unit tests for TTL expiry and invalidation. --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1408
No description provided.