From b5cb29304cdbe2ae3ce2c903ea5ff8a408399cd9 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 24 Jul 2014 13:23:23 -0700 Subject: Move indexes cache to CachedMusicService --- src/github/daneren2005/dsub/service/CachedMusicService.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java index 4f722d5c..611e438e 100644 --- a/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -131,7 +131,16 @@ public class CachedMusicService implements MusicService { } Indexes result = cachedIndexes.get(); if (result == null) { - result = musicService.getIndexes(musicFolderId, refresh, context, progressListener); + String name = Util.isTagBrowsing(context, musicService.getInstance(context)) ? "artists" : "indexes"; + name = getCacheName(context, name, musicFolderId); + if(!refresh) { + result = FileUtil.deserialize(context, name, Indexes.class); + } + + if(result == null) { + result = musicService.getIndexes(musicFolderId, refresh, context, progressListener); + FileUtil.serialize(context, result, name); + } cachedIndexes.set(result); } return result; -- cgit v1.2.3