Unverified Commit 3dafab91 authored by Josh Story's avatar Josh Story Committed by GitHub

[Cache Components] Allow stale longer than expire in cacheLife (#85115)

We previously encoded an invariant with cacheLife that required stale to
be greater than expire. This doesn't really make sense because these
describe completely different lifetimes. Stale starts from when the
client reads the response but expire starts from when the cache entry is
created. This removes the the requirement that expire be greater than
stale
parent 149f18e8
......@@ -72,17 +72,6 @@ function validateCacheLife(profile: CacheLife) {
)
}
}
if (profile.stale !== undefined && profile.expire !== undefined) {
if (profile.stale > profile.expire) {
throw new Error(
'If providing both the stale and expire options, ' +
'the expire option must be greater than the stale option. ' +
'The expire option indicates how many seconds from the start ' +
'until it can no longer be used.'
)
}
}
}
export function cacheLife(profile: CacheLifeProfiles | CacheLife): void {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment