mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
Add flag to enable new cache layout
This commit is contained in:
parent
81d7556cdf
commit
bf5318d776
2 changed files with 8 additions and 1 deletions
|
@ -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) {
|
||||
|
|
7
core/cache/file_caches.go
vendored
7
core/cache/file_caches.go
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue