allegro / allegro/bigcache

Why does cacheShard.set call onEvict?

オープン
#121 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る
discussion
主要言語
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。