Expose SERP cache TTL as SERP_CACHE_TTL_HOURS environment variable #858

Closed
opened 2026-03-29 04:22:23 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P2 - Backend - SERP cache TTL is hardcoded

The SERP result cache TTL is hardcoded to 24 hours. Operators cannot tune this without modifying source code.

Work to do

  1. Add SERP_CACHE_TTL_HOURS to config.py with a default value of 24.
  2. Update the cache logic in serp_api.py to read SERP_CACHE_TTL_HOURS from config.
  3. Update docker-compose.yml and .env.example to document the variable.
  4. Add a brief unit test verifying that a custom TTL is respected.

Acceptance criteria

  • Setting SERP_CACHE_TTL_HOURS=48 doubles the cache duration.
  • The default of 24 hours is preserved when the variable is unset.
  • No hardcoded TTL integer remains in serp_api.py.
## Context Roadmap item: P2 - Backend - SERP cache TTL is hardcoded The SERP result cache TTL is hardcoded to 24 hours. Operators cannot tune this without modifying source code. ## Work to do 1. Add `SERP_CACHE_TTL_HOURS` to `config.py` with a default value of `24`. 2. Update the cache logic in `serp_api.py` to read `SERP_CACHE_TTL_HOURS` from config. 3. Update `docker-compose.yml` and `.env.example` to document the variable. 4. Add a brief unit test verifying that a custom TTL is respected. ## Acceptance criteria - Setting `SERP_CACHE_TTL_HOURS=48` doubles the cache duration. - The default of 24 hours is preserved when the variable is unset. - No hardcoded TTL integer remains in `serp_api.py`.
AI-Manager added the P2agent-readysmallrefactor labels 2026-03-29 04:22:23 +00:00
Author
Owner

Resolved in codebase. SPARC/config.py line 46: serp_cache_ttl_hours = int(os.getenv('SERP_CACHE_TTL_HOURS', '24')). Used in analyzer.py for SERP query caching. Closing as implemented.

Resolved in codebase. SPARC/config.py line 46: serp_cache_ttl_hours = int(os.getenv('SERP_CACHE_TTL_HOURS', '24')). Used in analyzer.py for SERP query caching. Closing as implemented.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#858