mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-06 18:10:26 +08:00
内存缓存增加最大数量限制
This commit is contained in:
@@ -24,7 +24,7 @@ type Cache struct {
|
||||
|
||||
func NewCache(opt ...OptionInterface) *Cache {
|
||||
countPieces := 128
|
||||
maxItems := 1_000_000
|
||||
maxItems := 10_000_000
|
||||
for _, option := range opt {
|
||||
if option == nil {
|
||||
continue
|
||||
|
||||
@@ -65,6 +65,7 @@ func TestCache_Read(t *testing.T) {
|
||||
for i := 0; i < 10_000_000; i++ {
|
||||
cache.Write("HELLO_WORLD_"+strconv.Itoa(i), i, time.Now().Unix()+int64(i%10240)+1)
|
||||
}
|
||||
time.Sleep(10 * time.Second)
|
||||
|
||||
total := 0
|
||||
for _, piece := range cache.pieces {
|
||||
|
||||
Reference in New Issue
Block a user