Why does cacheShard.set call onEvict?
- 主要言語
- Go
- スター
- 8.2k
- フォーク
- 614
- 平均マージ
- 5日 12時間
- マージ済み PR(30日)
- 1
説明
I have two problems with this:
1. It is **redundant**, the oldest entry will be removed anyway if space is needed for the new entry
2. It can cause **set** to invoke **onRemoveWithReason** with both "Expired" and "NoSpace" This is troublesome because **cleanUp** also invokes **onRemoveWithReason** with "Expired," making it impossible to differentiate between when **set** invokes **onRemoveWithReason** and when **cleanUp** invokes **onRemoveWithReason**
Proposed solution: Only remove the oldest entry in **set** with reason "NoSpace"
The point in all this is that each function/goroutine which might remove something from the cache should have its own **distinct** reason for doing so, thus preventing overlap and therefore allowing a developer to know **precisely** why an entry was removed.,
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。