public void persist ( final ICacheManager mgr ) throws IOException { if ( delete ) return ; if ( sourceMapSize == 0 ) { // No source map. Just stream the file mgr . createCacheFileAsync ( "layer." , //$NON-NLS-1$ new ByteArrayInputStream ( bytes ) , new CreateCompletionCallback ( mgr ) ) ; } else { // cache entry contains source map info. Create a CacheData instance // and serialize object. Object data = new CacheData ( bytes , sourceMap ) ; mgr . externalizeCacheObjectAsync ( "layer." , //$NON-NLS-1$ data , new CreateCompletionCallback ( mgr ) ) ; } }
Asynchronously write the layer build content to disk and set filename to the name of the cache files when done .