mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-13 15:00:24 +08:00
缓存条件增加最小内容尺寸配置
This commit is contained in:
@@ -357,7 +357,7 @@ func (this *HTTPWriter) prepareCache(size int64) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if size >= 0 && ((cacheRef.MaxSizeBytes() > 0 && size > cacheRef.MaxSizeBytes()) ||
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ func TestNewCache(t *testing.T) {
|
|||||||
t.Log(cache.Read("a"))
|
t.Log(cache.Read("a"))
|
||||||
time.Sleep(2 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
t.Log(cache.Read("d"))
|
t.Log(cache.Read("d"))
|
||||||
|
t.Log(cache.Count(), "items")
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkCache_Add(b *testing.B) {
|
func BenchmarkCache_Add(b *testing.B) {
|
||||||
|
|||||||
Reference in New Issue
Block a user