public static void clearRedundantCaches ( List < GitHubServerConfig > configs ) { Path baseCacheDir = getBaseCacheDir ( ) ; if ( notExists ( baseCacheDir ) ) { return ; } final Set < String > actualNames = from ( configs ) . filter ( withEnabledCache ( ) ) . transform ( toCacheDir ( ) ) . transform ( cacheToName ( ) ) . toSet ( ) ; try ( DirectoryStream < Path > caches = newDirectoryStream ( baseCacheDir , notInCaches ( actualNames ) ) ) { deleteEveryIn ( caches ) ; } catch ( IOException e ) { LOGGER . warn ( "Can't list cache dirs in {}" , baseCacheDir , e ) ; } }
Removes all not active dirs with old caches . This method is invoked after each save of global plugin config