aboutsummaryrefslogtreecommitdiff
path: root/weed/util/chunk_cache/chunk_cache.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-08-17 20:15:53 -0700
committerChris Lu <chris.lu@gmail.com>2020-08-17 20:15:53 -0700
commitbe4d42b8e2bffd4a5ff650611f2cfb8c058ca26b (patch)
tree58cd3fc9b901ae282e3354cb5cb1c8be54eb68e7 /weed/util/chunk_cache/chunk_cache.go
parent0625e63648e8c4a2c4bc9dfe5b8d6011014518ce (diff)
downloadseaweedfs-be4d42b8e2bffd4a5ff650611f2cfb8c058ca26b.tar.xz
seaweedfs-be4d42b8e2bffd4a5ff650611f2cfb8c058ca26b.zip
rename
Diffstat (limited to 'weed/util/chunk_cache/chunk_cache.go')
-rw-r--r--weed/util/chunk_cache/chunk_cache.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/weed/util/chunk_cache/chunk_cache.go b/weed/util/chunk_cache/chunk_cache.go
index 6c6a45920..d01e2163b 100644
--- a/weed/util/chunk_cache/chunk_cache.go
+++ b/weed/util/chunk_cache/chunk_cache.go
@@ -14,15 +14,15 @@ const (
)
// a global cache for recently accessed file chunks
-type ChunkCache struct {
+type TieredChunkCache struct {
memCache *ChunkCacheInMemory
diskCaches []*OnDiskCacheLayer
sync.RWMutex
}
-func NewChunkCache(maxEntries int64, dir string, diskSizeMB int64) *ChunkCache {
+func NewTieredChunkCache(maxEntries int64, dir string, diskSizeMB int64) *TieredChunkCache {
- c := &ChunkCache{
+ c := &TieredChunkCache{
memCache: NewChunkCacheInMemory(maxEntries),
}
c.diskCaches = make([]*OnDiskCacheLayer, 3)
@@ -33,7 +33,7 @@ func NewChunkCache(maxEntries int64, dir string, diskSizeMB int64) *ChunkCache {
return c
}
-func (c *ChunkCache) GetChunk(fileId string, minSize uint64) (data []byte) {
+func (c *TieredChunkCache) GetChunk(fileId string, minSize uint64) (data []byte) {
if c == nil {
return
}
@@ -44,7 +44,7 @@ func (c *ChunkCache) GetChunk(fileId string, minSize uint64) (data []byte) {
return c.doGetChunk(fileId, minSize)
}
-func (c *ChunkCache) doGetChunk(fileId string, minSize uint64) (data []byte) {
+func (c *TieredChunkCache) doGetChunk(fileId string, minSize uint64) (data []byte) {
if minSize < memCacheSizeLimit {
data = c.memCache.GetChunk(fileId)
@@ -82,7 +82,7 @@ func (c *ChunkCache) doGetChunk(fileId string, minSize uint64) (data []byte) {
}
-func (c *ChunkCache) SetChunk(fileId string, data []byte) {
+func (c *TieredChunkCache) SetChunk(fileId string, data []byte) {
if c == nil {
return
}
@@ -94,7 +94,7 @@ func (c *ChunkCache) SetChunk(fileId string, data []byte) {
c.doSetChunk(fileId, data)
}
-func (c *ChunkCache) doSetChunk(fileId string, data []byte) {
+func (c *TieredChunkCache) doSetChunk(fileId string, data []byte) {
if len(data) < memCacheSizeLimit {
c.memCache.SetChunk(fileId, data)
@@ -116,7 +116,7 @@ func (c *ChunkCache) doSetChunk(fileId string, data []byte) {
}
-func (c *ChunkCache) Shutdown() {
+func (c *TieredChunkCache) Shutdown() {
if c == nil {
return
}