Why does cacheShard.set call onEvict?
- Langage dominant
- Go
- Étoiles
- 8.2k
- Forks
- 614
- Merge moyen
- 5 j 12 h
- PR mergées (30 j)
- 1
Description
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.,
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.