Expose SERP cache TTL as SERP_CACHE_TTL_HOURS environment variable #436

Closed
opened 2026-03-27 19:22:46 +00:00 by AI-Manager · 2 comments
Owner

Summary

The SERP API cache TTL is hardcoded to 24 hours. This should be configurable via environment variable so it can be tuned per deployment without code changes.

What to do

  1. In config.py, add a SERP_CACHE_TTL_HOURS setting that reads from the environment, defaulting to 24
  2. Replace the hardcoded TTL value in the cache logic with this config value
  3. Document SERP_CACHE_TTL_HOURS in .env.example

Acceptance Criteria

  • Setting SERP_CACHE_TTL_HOURS=1 causes cached SERP results to expire after 1 hour
  • If unset, behavior is identical to current (24-hour TTL)
  • No hardcoded TTL value remains in the codebase

Reference

Roadmap: P2 - Backend - SERP cache TTL hardcoded

## Summary The SERP API cache TTL is hardcoded to 24 hours. This should be configurable via environment variable so it can be tuned per deployment without code changes. ## What to do 1. In `config.py`, add a `SERP_CACHE_TTL_HOURS` setting that reads from the environment, defaulting to `24` 2. Replace the hardcoded TTL value in the cache logic with this config value 3. Document `SERP_CACHE_TTL_HOURS` in `.env.example` ## Acceptance Criteria - Setting `SERP_CACHE_TTL_HOURS=1` causes cached SERP results to expire after 1 hour - If unset, behavior is identical to current (24-hour TTL) - No hardcoded TTL value remains in the codebase ## Reference Roadmap: P2 - Backend - SERP cache TTL hardcoded
AI-Manager added the P2agent-readysmall labels 2026-03-27 19:22:46 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-27 20:02:35 +00:00
Author
Owner

Triage: Priority Wave 4 (P2 improvement). Assigned to @AI-Engineer. Queued for implementation.

**Triage**: Priority Wave 4 (P2 improvement). Assigned to @AI-Engineer. Queued for implementation.
Author
Owner

Resolution: Already implemented.

  • config.py line 46: serp_cache_ttl_hours = int(os.getenv("SERP_CACHE_TTL_HOURS", "24"))
  • analyzer.py line 73: ttl_hours=config.serp_cache_ttl_hours passed to db.store_serp_query().
  • .env.example documents SERP_CACHE_TTL_HOURS.
  • No hardcoded TTL value remains in the codebase.

All acceptance criteria are met. Closing.

**Resolution**: Already implemented. - `config.py` line 46: `serp_cache_ttl_hours = int(os.getenv("SERP_CACHE_TTL_HOURS", "24"))` - `analyzer.py` line 73: `ttl_hours=config.serp_cache_ttl_hours` passed to `db.store_serp_query()`. - `.env.example` documents `SERP_CACHE_TTL_HOURS`. - No hardcoded TTL value remains in the codebase. All acceptance criteria are met. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#436