protected Wikitty cacheGetWikitty(String id) { Wikitty result = null; if (id != null) { result = cache.getWikitty(id); // all time wrap, only WikittyImpl are in cache result = wrapWikitty(result); } return result; } protected WikittyExtension cacheGetExtensions(String id) {
/** * Only WikittyImpl can be put in real cache implementation. If argument * is WikittyCopyOnWrite, we must take internal wikitty to put in cache */ protected void cachePutWikitty(Wikitty w) { if (w != null) { if (w instanceof WikittyCopyOnWrite) { w = ((WikittyCopyOnWrite) w).getTarget(); } Wikitty old = cache.getWikitty(w.getWikittyId()); if (old == null || WikittyUtil.versionGreaterThan(w.getWikittyVersion(), old.getWikittyVersion())) { cache.putWikitty(w); if (log.isTraceEnabled()) { log.trace("Replace cached wikitty : new version " + w.getWikittyVersion() + " > old version " + (old == null ? null : old.getWikittyVersion())); } } else { if (log.isTraceEnabled()) { log.trace(String.format( "Ignoring putWikittyEvent : new version %s < old version %s", w.getWikittyVersion(), old.getWikittyVersion())); } } } }