Comment Comment by adamtulinius Your code should be written this way instead: if !cache.contains(key) { v = db.query("..") expiry = calcexpiry(v) cache.put(k, v, expiry) } return cache.get(k) Only one return, and everything is still in the logical order. parent adamtulinius 8 years ago