public SwiftCachedObject get ( final String objName ) throws IOException { LOG . trace ( "Get from cache: {}" , objName ) ; SwiftCachedObject res = cache . get ( objName ) ; if ( res == null ) { LOG . trace ( "Cache get: {} is not in the cache. Access Swift to get content length" , objName ) ; StoredObject rawObj = container . getObject ( removeTrailingSlash ( objName ) ) ; if ( rawObj != null && rawObj . exists ( ) ) { res = new SwiftCachedObject ( rawObj . getContentLength ( ) , Utils . lastModifiedAsLong ( rawObj . getLastModified ( ) ) ) ; put ( objName , res ) ; } else { return null ; } } return res ; }
The get function will first search for the object in the cache . If not found will issue a HEAD request for the object metadata and add the object to the cache .