diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/service/CachedMusicService.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java index b93a6e1e..4da3aec2 100644 --- a/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -82,7 +82,16 @@ public class CachedMusicService implements MusicService { checkSettingsChanged(context); Boolean result = cachedLicenseValid.get(); if (result == null) { - result = musicService.isLicenseValid(context, progressListener); + result = FileUtil.deserialize(context, getCacheName(context, "license"), Boolean.class); + + if(result == null) { + result = musicService.isLicenseValid(context, progressListener); + + // Only save a copy license is valid + if(result == true) { + FileUtil.serialize(context, (Boolean) result, getCacheName(context, "license")); + } + } cachedLicenseValid.set(result, result ? 30L * 60L : 2L * 60L, TimeUnit.SECONDS); } return result; |