mirror of
https://github.com/minio/minio.git
synced 2025-11-21 10:16:03 -05:00
Fixing panic in intelligent, attempted to delete nonexistent key
This commit is contained in:
@@ -134,6 +134,7 @@ func (r *Intelligent) Set(key string, value interface{}) {
|
|||||||
|
|
||||||
// Delete deletes a given key if exists
|
// Delete deletes a given key if exists
|
||||||
func (r *Intelligent) Delete(key string) {
|
func (r *Intelligent) Delete(key string) {
|
||||||
|
if _, ok := r.items[key]; ok {
|
||||||
r.currentSize -= uint64(len(r.items[key].([]byte)))
|
r.currentSize -= uint64(len(r.items[key].([]byte)))
|
||||||
delete(r.items, key)
|
delete(r.items, key)
|
||||||
delete(r.updatedAt, key)
|
delete(r.updatedAt, key)
|
||||||
@@ -142,6 +143,7 @@ func (r *Intelligent) Delete(key string) {
|
|||||||
r.OnEvicted(key)
|
r.OnEvicted(key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Intelligent) isValid(key string) bool {
|
func (r *Intelligent) isValid(key string) bool {
|
||||||
updatedAt, ok := r.updatedAt[key]
|
updatedAt, ok := r.updatedAt[key]
|
||||||
|
|||||||
Reference in New Issue
Block a user