Skip to content

Refactor cache_query_generic() - Separate strategies #112

@flyingrobots

Description

@flyingrobots

Part of SRP Refactoring (Priority 3: Data Processing)

Current Problem

cache_query_generic() in src/cache/query.c mixes initialization, cache attempt, and fallback logic.

Refactoring Plan

Split into:

  • query_from_cache() - Cache query only
  • query_from_journal() - Journal scan only
  • select_query_strategy() - Decision logic

Acceptance Criteria

  • Query strategies clearly separated
  • Strategy selection isolated
  • Each path independently testable
  • Fallback logic explicit
  • Performance monitoring possible
  • Clean interfaces

Technical Notes

  • Consider strategy pattern
  • Add query performance metrics
  • Make strategies pluggable

Related to SRP_REFACTORING_PLAN.md Priority 3.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactoringCode refactoring without changing functionalitytech-debtTechnical debt that needs addressing

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions