Skip to content

[Enhancement] Optimise cache fallback with a layered retrieval strategy [Reopen: #26] #70

Description

@shaaravraghu

NEW CONTRIBUTORS FIRST PREFERENCE.

Description
When an entry is not found in the primary in-memory cache, the application currently falls back to a single retrieval method. A layered fallback strategy should be introduced so that retrieval cascades through multiple methods in order of speed and cost, improving performance and reliability across varying system conditions.

Steps to Reproduce

  1. Allow the in-memory cache to evict or not contain a specific entry.
  2. Attempt to retrieve that entry.
  3. Observe that only one fallback method is attempted before failure.

Expected Behavior
Retrieval should cascade through a defined sequence of fallback layers — for example RAM, then disk, then encrypted vault — stopping as soon as the entry is found. Each layer should be tried only if the previous one did not return a result.

Actual Behavior
Only a single fallback path is attempted. If it does not return the entry, retrieval fails entirely regardless of whether other sources could have served it.

Example
An entry evicted from RAM but still present on disk is reported as missing because the fallback does not proceed to the disk layer after a RAM miss.

Suggested Fix
Define a formal cache fallback chain with clearly ordered layers. Each layer should be independently queryable and the retrieval logic should walk the chain until a hit is found or all layers are exhausted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions