private String databaseLoad ( Locator locator , String key ) throws CacheException { try { CacheKey cacheKey = new CacheKey ( locator , key ) ; Map < String , String > metadata = io . getAllValues ( locator ) ; if ( metadata == null || metadata . isEmpty ( ) ) { cache . put ( cacheKey , NULL ) ; return NULL ; } int metadataRowSize = 0 ; // prepopulate all other metadata other than the key we called the method with for ( Map . Entry < String , String > meta : metadata . entrySet ( ) ) { metadataRowSize += meta . getKey ( ) . getBytes ( ) . length + locator . toString ( ) . getBytes ( ) . length ; if ( meta . getValue ( ) != null ) metadataRowSize += meta . getValue ( ) . getBytes ( ) . length ; if ( meta . getKey ( ) . equals ( key ) ) continue ; CacheKey metaKey = new CacheKey ( locator , meta . getKey ( ) ) ; cache . put ( metaKey , meta . getValue ( ) ) ; } totalMetadataSize . update ( metadataRowSize ) ; String value = metadata . get ( key ) ; if ( value == null ) { cache . put ( cacheKey , NULL ) ; value = NULL ; } return value ; } catch ( IOException ex ) { throw new CacheException ( ex ) ; } }
implements the CacheLoader interface .