@SuppressWarnings("unchecked") /** * get a key. if varArgs is not null these values will be passed to the serializer in the case * that the cache object does not exist * * @param key cache key * @param varArgs arguments that will be passed to serializer when a key is not found * @return */ public Value get(Key key, Object... varArgs) { if (DEBUG) System.out.println(" - getting key = " + key + " contains=" + map.containsKey(key)); CacheElement o = map.get(key); // UniqueKey<Key> t = map.get(key); if (o == null) { MutableBoolean isdirty = new MutableBoolean(false); UniqueKey<Key> t = serializer.load(key, isdirty, varArgs); if (DEBUG) System.out.println(" - loaded element = " + t + " "); if (t == null) return null; o = new CacheElement(t); key = t.getKey(); synchronized (map) { map.put(key, o); } if (DEBUG) System.out.println( " - adding key = " + key + " contains=" + map.containsKey(key) + " dirty=" + dirty); if (isdirty.booleanValue()) { // / If its dirty, add to our dirty set synchronized (dirty) { dirty.add(key); } } } o.setUsed(); if (autoFlush && autoFlushTime != null) { flushOld(autoFlushTime); } return (Value) o.v; }