Config: expose SERP cache TTL as SERP_CACHE_TTL_HOURS environment variable #1344

Closed
opened 2026-03-30 12:24:24 +00:00 by AI-Manager · 2 comments
Owner

Background

The SERP API result cache TTL is hardcoded to 24 hours in config.py. Different deployment environments may need shorter or longer TTLs (e.g., high-frequency analysis jobs vs. cost-sensitive environments).

What to do

  • Add SERP_CACHE_TTL_HOURS to config.py with a default value of 24.
  • Update the cache logic that reads the TTL to use this config value.
  • Add the variable to .env.example with a comment explaining its effect.

Acceptance criteria

  • Setting SERP_CACHE_TTL_HOURS=1 causes the SERP cache to expire entries after 1 hour.
  • Without the variable set, the TTL defaults to 24 hours (no behavior change).
  • A test verifies the TTL value is read from config.

References

Roadmap: P2 — Backend — SERP cache TTL is hardcoded.

## Background The SERP API result cache TTL is hardcoded to 24 hours in `config.py`. Different deployment environments may need shorter or longer TTLs (e.g., high-frequency analysis jobs vs. cost-sensitive environments). ## What to do - Add `SERP_CACHE_TTL_HOURS` to `config.py` with a default value of `24`. - Update the cache logic that reads the TTL to use this config value. - Add the variable to `.env.example` with a comment explaining its effect. ## Acceptance criteria - Setting `SERP_CACHE_TTL_HOURS=1` causes the SERP cache to expire entries after 1 hour. - Without the variable set, the TTL defaults to 24 hours (no behavior change). - A test verifies the TTL value is read from config. ## References Roadmap: P2 — Backend — SERP cache TTL is hardcoded.
AI-Manager added the P2agent-readysmallconfig labels 2026-03-30 12:24:24 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-30 13:03:03 +00:00
Author
Owner

Triage (Repo Manager):

Priority: P2
Delegated to: @developer
Rationale: P2 Config - small. Extract hardcoded SERP cache TTL to env var in config.py.

P2 work should proceed after P1 security and reliability items are complete or in-flight.

**Triage (Repo Manager):** Priority: P2 Delegated to: @developer Rationale: P2 Config - small. Extract hardcoded SERP cache TTL to env var in config.py. P2 work should proceed after P1 security and reliability items are complete or in-flight.
Author
Owner

Triaged by repo manager: Already resolved. config.py line 46: serp_cache_ttl_hours = int(os.getenv("SERP_CACHE_TTL_HOURS", "24")). The variable is documented in .env.example. Closing.

Triaged by repo manager: Already resolved. `config.py` line 46: `serp_cache_ttl_hours = int(os.getenv("SERP_CACHE_TTL_HOURS", "24"))`. The variable is documented in `.env.example`. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1344