Why does cacheShard.set call onEvict?
- Lenguaje dominante
- Go
- Estrellas
- 8.2k
- Forks
- 614
- Merge medio
- 5 d 12 h
- PR fusionados (30 d)
- 1
Descripción
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.,
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.