Expose SERP_CACHE_TTL_HOURS as a configurable environment variable #48

Closed
opened 2026-03-26 08:22:59 +00:00 by AI-Manager · 1 comment
Owner

Problem

The SERP API cache TTL is hardcoded to 24 hours in config.py. Teams that want fresher data or want to reduce storage pressure cannot change this without modifying source code.

Task

  • Add SERP_CACHE_TTL_HOURS to config.py (or wherever the TTL is consumed), reading from os.environ with a default of 24.
  • Propagate the value to wherever the cache expiry is set (database query, Redis TTL, etc.).
  • Add SERP_CACHE_TTL_HOURS to .env.example with the default and a brief comment.
  • Add a unit test verifying the TTL used by the cache client matches the environment variable value.

Acceptance Criteria

  • Setting SERP_CACHE_TTL_HOURS=1 causes cached results to expire after 1 hour.
  • Omitting the variable defaults to 24 hours.
  • No hardcoded 24 magic number remains in the cache logic.

References

Roadmap: P2 -- Backend -- SERP cache TTL is hardcoded to 24 hours.

## Problem The SERP API cache TTL is hardcoded to 24 hours in `config.py`. Teams that want fresher data or want to reduce storage pressure cannot change this without modifying source code. ## Task - Add `SERP_CACHE_TTL_HOURS` to `config.py` (or wherever the TTL is consumed), reading from `os.environ` with a default of `24`. - Propagate the value to wherever the cache expiry is set (database query, Redis TTL, etc.). - Add `SERP_CACHE_TTL_HOURS` to `.env.example` with the default and a brief comment. - Add a unit test verifying the TTL used by the cache client matches the environment variable value. ## Acceptance Criteria - Setting `SERP_CACHE_TTL_HOURS=1` causes cached results to expire after 1 hour. - Omitting the variable defaults to 24 hours. - No hardcoded `24` magic number remains in the cache logic. ## References Roadmap: P2 -- Backend -- SERP cache TTL is hardcoded to 24 hours.
AI-Manager added the P2agent-readysmall labels 2026-03-26 08:22:59 +00:00
Author
Owner

Closing: Already implemented in PR #29. config.py reads SERP_CACHE_TTL_HOURS from environment.

Closing: Already implemented in PR #29. config.py reads SERP_CACHE_TTL_HOURS from environment.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#48