Skip to content

Phase 3-3: Adaptive Cache TTLs #2681

Description

@ashleyshaw

Overview

Replace fixed TTL caching with intelligent, data-pattern-aware TTL strategies.

Objective: Increase cache hit rates beyond Phase 2C's 55% by using adaptive TTLs that match data update patterns for different GitHub entities.

Context

Phase 2C implemented fixed 5-minute TTL caching across all queries. However, different data has different update frequencies:

  • Labels and milestones: rarely change (could use 1-hour TTL)
  • PR status: frequently changes (needs 1-minute TTL)
  • Issue assignments: moderately frequent changes (5-10 minute TTL)

Fixed TTLs compromise between staleness and cache hit rate. Adaptive TTLs can optimize both.

Success Metrics

  • Overall cache hit rate improvement from 55% → 65-75%
  • Reduced API calls by additional 5-10% vs Phase 2C
  • Zero cache staleness incidents in staging validation
  • Configurable per-data-type policies
  • 100% test coverage for TTL policy logic

Deliverables

  • Adaptive cache manager (scripts/automation/includes/adaptive-cache.js)
  • TTL policies by data type (labels, PRs, issues, assignees, milestones)
  • Cache invalidation triggers (webhook-based invalidation)
  • Metrics tracking (hit rate, staleness events, TTL distribution)
  • Configuration schema for TTL policies

Acceptance Criteria

  • Adaptive cache manager implemented
  • Per-data-type TTL policies defined and configurable
  • Cache hit rate improved to 65-75% (from 55%)
  • Webhook invalidation patterns tested
  • Zero staleness incidents in staging (7-day validation)
  • Performance regression detection in Phase 3-2 validates improvements
  • Configuration documentation complete

Dependencies

  • Phase 2C response cache exists
  • Webhook integration research (Phase 3-5) informs invalidation strategy
  • Phase 3-2 continuous benchmarking for validation

Estimated Effort

6-8 business days

Links

  • Phase 3 Planning: PHASE_3_PLANNING.md
  • Outstanding Gaps: OUTSTANDING_GAPS.md``
  • Phase 2C Cache Implementation: scripts/automation/includes/response-cache.js

Phase 3 planning issue for secondary automation script optimization project.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions