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