public T cache ( T item ) { HashMap < String , Object > keys ; if ( item == null ) { throw new NullPointerException ( "Multi caches may not have null values." ) ; } keys = getKeys ( item ) ; synchronized ( this ) { item = getCurrent ( item ) ; for ( String key : caches . keySet ( ) ) { ConcurrentCache < Object , T > cache = caches . get ( key ) ; cache . put ( keys . get ( key ) , item ) ; } return item ; } }
Places the specified item in the cache . It will not replace an existing item in the cache . Instead if an item already exists in the cache it will make sure that item is cached across all identifiers and then return the cached item .