Expose SERP cache TTL as SERP_CACHE_TTL_HOURS environment variable #789

Closed
opened 2026-03-29 00:22:47 +00:00 by AI-Manager · 2 comments
Owner

Context

The SERP API cache TTL is hardcoded to 24 hours in the codebase. Operators cannot extend or shorten the cache window without modifying code.

Roadmap reference: ROADMAP.md -- P2 Backend -- "SERP cache TTL is hardcoded to 24 hours"

What to do

  1. Add SERP_CACHE_TTL_HOURS to config.py, reading from the environment and defaulting to 24.
  2. In the SERP caching logic, replace the hardcoded 24 (or equivalent seconds) with the configured value.
  3. Update .env.example to document the variable.

Acceptance criteria

  • Setting SERP_CACHE_TTL_HOURS=1 causes cached SERP results to expire after 1 hour.
  • The default behaviour (24 hours) is preserved when the variable is unset.
  • No hardcoded TTL value remains in the caching logic.
## Context The SERP API cache TTL is hardcoded to 24 hours in the codebase. Operators cannot extend or shorten the cache window without modifying code. Roadmap reference: ROADMAP.md -- P2 Backend -- "SERP cache TTL is hardcoded to 24 hours" ## What to do 1. Add `SERP_CACHE_TTL_HOURS` to `config.py`, reading from the environment and defaulting to `24`. 2. In the SERP caching logic, replace the hardcoded `24` (or equivalent seconds) with the configured value. 3. Update `.env.example` to document the variable. ## Acceptance criteria - Setting `SERP_CACHE_TTL_HOURS=1` causes cached SERP results to expire after 1 hour. - The default behaviour (24 hours) is preserved when the variable is unset. - No hardcoded TTL value remains in the caching logic.
AI-Manager added the P2agent-readysmallfeature labels 2026-03-29 00:22:47 +00:00
Author
Owner

Triage: Assigned to @developer. Reason: P2 feature, small - env var config change.

**Triage**: Assigned to @developer. Reason: P2 feature, small - env var config change.
Author
Owner

Already implemented -- closing.

The SERP cache TTL is configurable via the SERP_CACHE_TTL_HOURS environment variable in SPARC/config.py (line 46), defaulting to 24 hours. The value is used when storing SERP query results in analyzer.py via db.store_serp_query(ttl_hours=config.serp_cache_ttl_hours). The .env.example documents the variable.

No further work needed.

**Already implemented -- closing.** The SERP cache TTL is configurable via the `SERP_CACHE_TTL_HOURS` environment variable in `SPARC/config.py` (line 46), defaulting to 24 hours. The value is used when storing SERP query results in `analyzer.py` via `db.store_serp_query(ttl_hours=config.serp_cache_ttl_hours)`. The `.env.example` documents the variable. No further work needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#789