Browse Source

make a local copy of the in memory cached data

pull/1943/head
Chris Lu 4 years ago
parent
commit
4abb511db3
  1. 4
      weed/util/chunk_cache/chunk_cache_in_memory.go

4
weed/util/chunk_cache/chunk_cache_in_memory.go

@ -32,5 +32,7 @@ func (c *ChunkCacheInMemory) GetChunk(fileId string) []byte {
}
func (c *ChunkCacheInMemory) SetChunk(fileId string, data []byte) {
c.cache.Set(fileId, data, time.Hour)
localCopy := make([]byte, len(data))
copy(localCopy, data)
c.cache.Set(fileId, localCopy, time.Hour)
}
Loading…
Cancel
Save