On delete, always set promotions == -2 and node == nil

Also, item.promotions doesn't need to be loaded/stored using atomic. Once upon a
time it did. Cache was updated long ago to not use atomic operations on it, but
LayeredCache wasn't. They are both consistent now (they don't use atomic
operations).

Fixes: https://github.com/karlseguin/ccache/issues/76
This commit is contained in:
Karl Seguin
2022-12-13 20:33:58 +08:00
parent 3452e4e261
commit ece93bf87d
4 changed files with 9 additions and 5 deletions

View File

@@ -391,7 +391,7 @@ func Test_LayeredCachePrune(t *testing.T) {
cache.Set(key, key, key, 5*time.Minute)
}
if epoch%500 == 0 {
assert.True(t, cache.GetSize() < 500)
assert.True(t, cache.GetSize() <= 500)
}
}
}