缓存条件增加最小内容尺寸配置

This commit is contained in:
GoEdgeLab
2021-09-26 15:01:46 +08:00
parent 25f5de8b7c
commit 1afb5dfcc7
2 changed files with 2 additions and 1 deletions

View File

@@ -357,7 +357,7 @@ func (this *HTTPWriter) prepareCache(size int64) {
return
}
if size >= 0 && ((cacheRef.MaxSizeBytes() > 0 && size > cacheRef.MaxSizeBytes()) ||
(cachePolicy.MaxSizeBytes() > 0 && size > cachePolicy.MaxSizeBytes())) {
(cachePolicy.MaxSizeBytes() > 0 && size > cachePolicy.MaxSizeBytes()) || (cacheRef.MinSizeBytes() > size)) {
return
}

View File

@@ -25,6 +25,7 @@ func TestNewCache(t *testing.T) {
t.Log(cache.Read("a"))
time.Sleep(2 * time.Second)
t.Log(cache.Read("d"))
t.Log(cache.Count(), "items")
}
func BenchmarkCache_Add(b *testing.B) {