Add functionality to make cache limit configurable (#5991)

This commit is contained in:
Annanay Agarwal
2018-06-25 22:54:12 +05:30
committed by kannappanr
parent f46ee54194
commit 78abe5234e
20 changed files with 327 additions and 13 deletions

View File

@@ -44,7 +44,6 @@ const (
// disk cache needs to have cacheSizeMultiplier * object size space free for a cache entry to be created.
cacheSizeMultiplier = 100
cacheTrashDir = "trash"
cacheMaxDiskUsagePct = 80 // in %
cacheCleanupInterval = 10 // in minutes
)
@@ -839,7 +838,7 @@ func newCache(config CacheConfig) (*diskCache, error) {
if err := checkAtimeSupport(dir); err != nil {
return nil, errors.New("Atime support required for disk caching")
}
cache, err := newCacheFSObjects(dir, config.Expiry, cacheMaxDiskUsagePct)
cache, err := newCacheFSObjects(dir, config.Expiry, config.MaxUse)
if err != nil {
return nil, err
}