aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/wfs.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-04-12 00:52:54 -0700
committerChris Lu <chris.lu@gmail.com>2020-04-12 00:52:54 -0700
commit211d87cf4c6afed1704733654ad3944bf40dd2bd (patch)
tree4c7cd8770ea76a65969e53a25c65e8593d7dd1bc /weed/filesys/wfs.go
parent1c65656fb4a64ae739b9a23a2f97f4032182015c (diff)
downloadseaweedfs-211d87cf4c6afed1704733654ad3944bf40dd2bd.tar.xz
seaweedfs-211d87cf4c6afed1704733654ad3944bf40dd2bd.zip
mount: option to disable caching
Diffstat (limited to 'weed/filesys/wfs.go')
-rw-r--r--weed/filesys/wfs.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index b2f68c030..64c5d5aa6 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -73,10 +73,6 @@ type statsCache struct {
}
func NewSeaweedFileSystem(option *Option) *WFS {
- chunkCache := chunk_cache.NewChunkCache(256, option.CacheDir, option.CacheSizeMB, 4)
- util.OnInterrupt(func() {
- chunkCache.Shutdown()
- })
wfs := &WFS{
option: option,
listDirectoryEntriesCache: ccache.New(ccache.Configure().MaxSize(option.DirListCacheLimit * 3).ItemsToPrune(100)),
@@ -86,7 +82,12 @@ func NewSeaweedFileSystem(option *Option) *WFS {
return make([]byte, option.ChunkSizeLimit)
},
},
- chunkCache: chunkCache,
+ }
+ if option.CacheSizeMB > 0 {
+ wfs.chunkCache = chunk_cache.NewChunkCache(256, option.CacheDir, option.CacheSizeMB, 4)
+ util.OnInterrupt(func() {
+ wfs.chunkCache.Shutdown()
+ })
}
wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs}