Files
flyer-crawler.projectium.com/docs/adr/0009-caching-strategy-for-read-heavy-operations.md
Torben Sorensen d004efb84b
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 16m21s
testing ADR - architectural decisions
2025-12-12 10:57:49 -08:00

1.2 KiB

ADR-009: Caching Strategy for Read-Heavy Operations

Date: 2025-12-12

Status: Proposed

Context

The application has several read-heavy endpoints (e.g., getting flyer items, recipes, brands). As traffic increases, these endpoints will put significant load on the database, even for data that changes infrequently.

Decision

We will implement a multi-layered caching strategy using an in-memory data store like Redis.

  1. Define Cacheable Data: Identify data suitable for caching (e.g., flyer data, recipe details, brand lists).
  2. Define Invalidation Strategy: Determine the cache invalidation strategy (e.g., time-to-live (TTL), event-based invalidation on data update).
  3. Implement Cache-Aside Pattern: The repository layer will be updated to implement a "Cache-Aside" pattern, where methods first check Redis for data before falling back to the database.

Consequences

Positive: Directly addresses application performance and scalability. Reduces database load and improves API response times for common requests. Negative: Introduces Redis as a dependency if not already used. Adds complexity to the data-fetching logic and requires careful management of cache invalidation to prevent stale data.