Skip to content

feat(cache): Implement Redis Caching Layer for Listings Performance Optimization#364

Open
Emrys02 wants to merge 6 commits intoOgstevyn:mainfrom
Emrys02:feat/redis-cache-layer
Open

feat(cache): Implement Redis Caching Layer for Listings Performance Optimization#364
Emrys02 wants to merge 6 commits intoOgstevyn:mainfrom
Emrys02:feat/redis-cache-layer

Conversation

@Emrys02
Copy link
Copy Markdown
Contributor

@Emrys02 Emrys02 commented Mar 27, 2026

Overview

Implement a centralized Redis caching layer for PayEasy listings using Upstash.

Important

Implementation Status: This PR establishes the core Infrastructure and Caching Wrapper logic. The API routes currently use temporary placeholder callbacks for the data source. These must be replaced with real backend logic (DB/Blockchain) in a subsequent PR.

Technical Improvements

  • Redis Infrastructure: Initialized Upstash Redis in lib/redis.ts and unified listing data structures in lib/types.ts.
  • Caching Logic: Implemented lib/listings.ts as an intelligent caching wrapper:
    • List Views: 15m TTL with automatic invalidation on mutations (Create/Update).
    • Detail Views: 1h TTL for static entries.
  • Gateway Endpoints: Created endpoints at /api/listings and /api/listings/[id] with built-in Cache-Control headers for both server and browser-side caching.
  • Configuration: Created .env.example with standard project credentials including Redis, MongoDB, JWT, and Stellar network settings.

Key Caching Details

  • Key Patterns: listings:all:page:${page} and listings:detail:${id}.
  • Headers: Cache-Control: public, max-age=900 (List) / max-age=3600 (Detail).

Verification

  1. Set credentials in .env.local.
  2. Visit /api/listings or /api/listings/1 once (Cache Miss) and twice (Cache Hit).
  3. Check server logs for [Cache Hit] and [Cache Invalidation] events.

Closes #32

@Emrys02 Emrys02 changed the title feat(cache): Implement Redis Caching Layer for Listings Performance Optimization (#32) feat(cache): Implement Redis Caching Layer for Listings Performance Optimization Mar 27, 2026
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@Emrys02 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

@Emrys02 Emrys02 marked this pull request as ready for review March 27, 2026 06:50
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.

Create Listings Performance Optimization with Caching

1 participant