实现缓存策略最大容量

This commit is contained in:
刘祥超
2020-10-05 20:23:18 +08:00
parent 78a2480836
commit 6d2f18387f
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