public static synchronized void add ( URL url , SourcePicture sp ) { Tools . log ( "PictureCache.add: " + url . toString ( ) ) ; if ( sp . getSourceBufferedImage ( ) == null ) { Tools . log ( "PictureCache.add: invoked with a null picture! Not cached!" ) ; return ; } if ( ( maxCache < 1 ) ) { Tools . log ( "PictureCache.add: cache is diabled. Not adding picture." ) ; return ; } if ( isInCache ( url ) ) { Tools . log ( "Picture " + url . toString ( ) + " is already in the cache. Not adding again." ) ; return ; } if ( pictureCache . size ( ) >= maxCache ) removeLeastPopular ( ) ; if ( pictureCache . size ( ) < maxCache ) pictureCache . put ( url . toString ( ) , sp ) ; //reportCache(); }
store an image in the cache