diff options
author | Simon Rettberg | 2015-09-09 11:11:04 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-09-09 11:11:04 +0200 |
commit | 1b7793a849cb7302c71012a81f1c4996b5d40e48 (patch) | |
tree | a62ff2b67fead2625d1b96166c082d53a9edd53f /dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java | |
parent | [server] Json package changed (diff) | |
download | tutor-module-1b7793a849cb7302c71012a81f1c4996b5d40e48.tar.gz tutor-module-1b7793a849cb7302c71012a81f1c4996b5d40e48.tar.xz tutor-module-1b7793a849cb7302c71012a81f1c4996b5d40e48.zip |
[client] Tweak caching strategies for meta data
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java index 98f54d36..0e9f8ea4 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/MetaDataCache.java @@ -55,10 +55,14 @@ public class MetaDataCache { } public static OperatingSystem getOsById(int id) { + return getOsById(id, false); + } + + public static OperatingSystem getOsById(int id, boolean forceCache) { // First, try in "always cached" mode - List<OperatingSystem> list = osCache.get(CacheMode.ALWAYS_CACHED); + List<OperatingSystem> list = osCache.get(CacheMode.FORCE_CACHED); OperatingSystem os = getOsById(id, list); - if (os != null) + if (os != null || forceCache) return os; // Try again with a potential refresh List<OperatingSystem> newList = osCache.get(CacheMode.DEFAULT); @@ -85,12 +89,16 @@ public class MetaDataCache { public static List<Virtualizer> getVirtualizers() { return virtualizerCache.get(); } - + public static Virtualizer getVirtualizerById(String virtId) { + return getVirtualizerById(virtId, false); + } + + public static Virtualizer getVirtualizerById(String virtId, boolean forceCache) { // First, try in "always cached" mode - List<Virtualizer> list = virtualizerCache.get(CacheMode.ALWAYS_CACHED); + List<Virtualizer> list = virtualizerCache.get(CacheMode.FORCE_CACHED); Virtualizer virt = getVirtualizerById(virtId, list); - if (virt != null) + if (virt != null || forceCache) return virt; // Try again with a potential refresh List<Virtualizer> newList = virtualizerCache.get(CacheMode.DEFAULT); |