You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
If the maximum number of cached requests is specified to the setupCache function, I would expect the oldest cache entry (by comparing the expires value in each stored item) will be removed from the store when the store size is reaching the limit.
However, a random entry in the cache will be removed instead when using the built-in MemoryStore or RedisStore, essentially item with the first key from the result of Object.keys({ /* entries map */ }), which is nondeterministic.
I am wondering, is this expected? But it seems more like a bug. 🤔
// Related option for `setupCache()`
{
// {Number} Maximum number of cached request (last in, first out queue system),
// defaults to `false` for no limit. *Cannot be overridden per request*
limit: false,
}
Note that you can reproduce the issue with the modified test cases in my linked PR below. 🙂
zhenwenc
changed the title
Oldest cache doesn't get invalidated when exceeding store limit
Invalidate oldest cache entry when exceeding store limit
May 19, 2021
If the maximum number of cached requests is specified to the
setupCache
function, I would expect the oldest cache entry (by comparing theexpires
value in each stored item) will be removed from the store when the store size is reaching the limit.However, a random entry in the cache will be removed instead when using the built-in
MemoryStore
orRedisStore
, essentially item with the first key from the result ofObject.keys({ /* entries map */ })
, which is nondeterministic.I am wondering, is this expected? But it seems more like a bug. 🤔
Note that you can reproduce the issue with the modified test cases in my linked PR below. 🙂
PR for the fix: PR for the fix: #248
The text was updated successfully, but these errors were encountered: