实现缓存策略最大容量

This commit is contained in:
GoEdgeLab
2020-10-05 20:23:18 +08:00
parent 9c0c772226
commit b4cfc33875
6 changed files with 70 additions and 7 deletions

View File

@@ -43,6 +43,7 @@ func (this *MemoryWriter) Write(data []byte) (n int, err error) {
item.Value = append([]byte{}, data...)
item.ExpiredAt = this.expiredAt
this.m[hash] = item
this.isFirstWriting = false
}
this.locker.Unlock()
return len(data), nil