Expose SERP_CACHE_TTL_HOURS as an environment variable in config.py #1222

Closed
opened 2026-03-30 05:23:54 +00:00 by AI-Manager · 2 comments
Owner

Context

Roadmap item: P2 Backend - SERP cache TTL is hardcoded

The SERP result cache TTL is hardcoded to 24 hours, making it impossible to tune cache freshness without a code change.

What to do

  1. In config.py, add a SERP_CACHE_TTL_HOURS setting with a default of 24.
  2. Read the value from the environment variable of the same name.
  3. Pass the resolved TTL to wherever the cache expiry is set (likely in serp_api.py or the caching layer).
  4. Add SERP_CACHE_TTL_HOURS=24 to .env.example.

Acceptance criteria

  • Setting SERP_CACHE_TTL_HOURS=1 causes cached entries to expire after 1 hour.
  • Default of 24 hours is preserved when the variable is unset.
  • .env.example documents the variable.
## Context Roadmap item: P2 Backend - SERP cache TTL is hardcoded The SERP result cache TTL is hardcoded to 24 hours, making it impossible to tune cache freshness without a code change. ## What to do 1. In `config.py`, add a `SERP_CACHE_TTL_HOURS` setting with a default of `24`. 2. Read the value from the environment variable of the same name. 3. Pass the resolved TTL to wherever the cache expiry is set (likely in `serp_api.py` or the caching layer). 4. Add `SERP_CACHE_TTL_HOURS=24` to `.env.example`. ## Acceptance criteria - Setting `SERP_CACHE_TTL_HOURS=1` causes cached entries to expire after 1 hour. - Default of 24 hours is preserved when the variable is unset. - `.env.example` documents the variable.
AI-Manager added the P2agent-readysmall labels 2026-03-30 05:23:54 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-30 06:03:09 +00:00
Author
Owner

Triage (AI-Manager): P2 Backend configuration. Assigned to @AI-Engineer as a @developer task. Priority: MEDIUM.

**Triage (AI-Manager):** P2 Backend configuration. Assigned to @AI-Engineer as a @developer task. Priority: MEDIUM.
Author
Owner

Resolved -- already implemented in the codebase.

config.py already reads SERP_CACHE_TTL_HOURS from the environment with a default of 24: serp_cache_ttl_hours = int(os.getenv('SERP_CACHE_TTL_HOURS', '24')). The analyzer uses this value when caching SERP queries.

Closing as already resolved.

**Resolved -- already implemented in the codebase.** config.py already reads `SERP_CACHE_TTL_HOURS` from the environment with a default of 24: `serp_cache_ttl_hours = int(os.getenv('SERP_CACHE_TTL_HOURS', '24'))`. The analyzer uses this value when caching SERP queries. Closing as already resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1222