comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverviewFactory.java @ 2622:8bc1e1cb7f7b

Fixed the fixings columns caching problem. flys-artifacts/trunk@4207 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 06 Apr 2012 10:12:34 +0000
parents b3f6d49cdc80
children
comparison
equal deleted inserted replaced
2621:f0cc556eda29 2622:8bc1e1cb7f7b
21 } 21 }
22 22
23 23
24 public static FixingsOverview getOverview(String river) { 24 public static FixingsOverview getOverview(String river) {
25 25
26 log.debug("Looking for fixings overview for river '" + river + "'"); 26 boolean debug = log.isDebugEnabled();
27
28 if (debug) {
29 log.debug(
30 "Looking for fixings overview for river '" + river + "'");
31 }
27 32
28 Cache cache = CacheFactory.getCache(CACHE_NAME); 33 Cache cache = CacheFactory.getCache(CACHE_NAME);
29 34
30 if (cache == null) { 35 if (cache == null) {
36 if (debug) {
37 log.debug("Cache not configured.");
38 }
31 return getUncached(river); 39 return getUncached(river);
32 } 40 }
33 41
34 String key = "fix-over-" + river; 42 String key = "fix-over-" + river;
35 43
36 Element element = cache.get(key); 44 Element element = cache.get(key);
37 45
38 if (element != null) { 46 if (element != null) {
47 if (debug) {
48 log.debug("Overview found in cache");
49 }
39 return (FixingsOverview)element.getValue(); 50 return (FixingsOverview)element.getValue();
40 } 51 }
41 52
42 FixingsOverview overview = getUncached(river); 53 FixingsOverview overview = getUncached(river);
43 54
44 if (overview != null) { 55 if (overview != null) {
45 element = new Element(key, overview); 56 if (debug) {
46 cache.put(element); 57 log.debug("Store overview in cache.");
58 }
59 cache.put(new Element(key, overview));
47 } 60 }
48 61
49 return overview; 62 return overview;
50 } 63 }
51 64

http://dive4elements.wald.intevation.org