Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: python-cachier/cachier
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: python-cachier/cachier
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: consigai/master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 10 files changed
  • 1 contributor

Commits on Oct 2, 2025

  1. feat: add return_stale_on_timeout parameter for stale-while-revalidat…

    …e caching
    
    Adds new `return_stale_on_timeout` parameter that enables returning stale
    cached values when `wait_for_calc_timeout` expires, instead of triggering
    a new calculation. This implements a stale-while-revalidate pattern that
    keeps applications responsive while ensuring background cache refresh.
    
    Key changes:
    - Add return_stale_on_timeout parameter to all cache backends
    - Modify core logic to return stale values on RecalculationNeeded exception
    - Fix memory core timeout handling to properly check wait_for_calc_timeout
    - Add comprehensive test suite with 7 test cases
    - Update documentation and maintain backward compatibility
    
    When enabled, the behavior follows this pattern:
    1. Fresh values (≤ stale_after) return immediately
    2. Stale values trigger background refresh
    3. Caller waits up to wait_for_calc_timeout for refresh to complete
    4. If timeout expires, return stale value instead of blocking
    5. Background refresh continues for next request
    
    Closes: Implements stale-while-revalidate caching pattern
    zscgeek authored and Borda committed Oct 2, 2025
    Configuration menu
    Copy the full SHA
    258e462 View commit details
    Browse the repository at this point in the history
Loading