/** * Convenience method to add an object with its key to the cache. This creates the CachedObject * wrapper to manage its state. If the object already exists in the cache, it updates its value. * * @param cacheable * @return */ public CachedObject add(Cacheable cacheable) { Identifier key = cacheable.getIdentifier(); CachedObject co = get(key); if (co == null) { co = new CachedObject(); co.setKey(key.toString()); put(key, co); } co.setValue(cacheable); return co; }
/** * Checks if the cacheable object is in this cache. * * @param cacheable * @return */ public boolean containsObject(Cacheable cacheable) { return getTheRealCache().containsKey(cacheable.getIdentifier()); }