aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005/dsub/service/CachedMusicService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/github/daneren2005/dsub/service/CachedMusicService.java')
-rw-r--r--src/github/daneren2005/dsub/service/CachedMusicService.java11
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 a7a61f71..99f21d6e 100644
--- a/src/github/daneren2005/dsub/service/CachedMusicService.java
+++ b/src/github/daneren2005/dsub/service/CachedMusicService.java
@@ -83,7 +83,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;