diff --git a/conf/configuration.go b/conf/configuration.go index 86051de30..92a3979f0 100644 --- a/conf/configuration.go +++ b/conf/configuration.go @@ -49,6 +49,7 @@ type configOptions struct { DevLogSourceLine bool DevAutoCreateAdminPassword string DevPreCacheAlbumArtwork bool + DevNewCacheLayout bool } type scannerOptions struct { @@ -134,6 +135,7 @@ func init() { viper.SetDefault("devlogsourceline", false) viper.SetDefault("devautocreateadminpassword", "") viper.SetDefault("devprecachealbumartwork", false) + viper.SetDefault("devnewcachelayout", false) } func InitConfig(cfgFile string) { diff --git a/core/cache/file_caches.go b/core/cache/file_caches.go index b9eb78eda..44aad5c5e 100644 --- a/core/cache/file_caches.go +++ b/core/cache/file_caches.go @@ -187,8 +187,13 @@ func newFSCache(name, cacheSize, cacheFolder string, maxItems int) (fscache.Cach h := fscache.NewLRUHaunterStrategy(lru) cacheFolder = filepath.Join(conf.Server.DataFolder, cacheFolder) + var fs fscache.FileSystem log.Info(fmt.Sprintf("Creating %s cache", name), "path", cacheFolder, "maxSize", humanize.Bytes(size)) - fs, err := NewSpreadFS(cacheFolder, 0755) + if conf.Server.DevNewCacheLayout { + fs, err = NewSpreadFS(cacheFolder, 0755) + } else { + fs, err = fscache.NewFs(cacheFolder, 0755) + } if err != nil { log.Error(fmt.Sprintf("Error initializing %s cache", name), err, "elapsedTime", time.Since(start)) return nil, err