public void CacheEntry_AccessDoesNotExtendExpiration()

in CachingProxyTests/src/ResponseCacheTest.cs [47:66]


  public void CacheEntry_AccessDoesNotExtendExpiration()
  {
    const string key = "test-key";
    _cache.PutStatusCode(key, HttpStatusCode.OK, null, null, null, null);

    // Simulate high-load access pattern: access every 30 seconds
    // With sliding expiration, these repeated accesses would keep extending the entry
    for (int i = 0; i < 9; i++) // 4.5 minutes of accesses (well within 5 min TTL)
    {
      _timeProvider.Advance(TimeSpan.FromSeconds(30));
      Assert.NotNull(_cache.GetCachedStatusCode(key));
    }

    // Advance past the 5-minute expiration (total: 4.5 + 1.5 = 6 minutes)
    _timeProvider.Advance(TimeSpan.FromMinutes(1) + TimeSpan.FromSeconds(30));

    // Entry should be expired despite repeated access
    // (with sliding expiration, it would still exist due to repeated access resetting the timer)
    Assert.Null(_cache.GetCachedStatusCode(key));
  }