borgbutler-core/src/main/java/de/micromata/borgbutler/cache/ButlerCache.java
@@ -41,7 +41,7 @@ public RepoInfo getRepoInfo(String idOrName) { BorgRepoConfig repoConfig = ConfigurationHandler.getConfiguration().getRepoConfig(idOrName); RepoInfo repoInfo = repoInfoCacheAccess.get(repoConfig.getRepo()); if (repoInfo == null) { if (repoInfo == null ||repoInfo.getRepository() == null) { repoInfo = BorgCommands.info(repoConfig); repoInfoCacheAccess.put(repoConfig.getRepo(), repoInfo); } @@ -63,7 +63,16 @@ return repositories; } public void clearAllCacheAccess(){ log.info("Clearing repositories cache (with list of archives)..."); this.repoListCacheAccess.clear(); clearRepoInfoCacheAccess(); log.info("Clearing cache with file lists of archives..."); this.archiveFilelistCache.removeAllCacheFiles(); } public void clearRepoInfoCacheAccess() { log.info("Clearing repositories info cache..."); this.repoInfoCacheAccess.clear(); } borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ConfigurationRest.java
@@ -1,5 +1,6 @@ package de.micromata.borgbutler.server.rest; import de.micromata.borgbutler.cache.ButlerCache; import de.micromata.borgbutler.json.JsonUtils; import de.micromata.borgbutler.server.ServerConfiguration; import de.micromata.borgbutler.server.ServerConfigurationHandler; @@ -84,4 +85,16 @@ } return getConfig(false); } /** * Resets the settings to default values (deletes all settings). */ @GET @Path("clearAllCaches") @Produces(MediaType.APPLICATION_JSON) public String clearAllCaches() { log.info("Clear all caches called..."); ButlerCache.getInstance().clearRepoInfoCacheAccess(); return "OK"; } } borgbutler-webapp/src/components/views/config/ConfigurationServerTab.jsx
@@ -77,6 +77,7 @@ this.addDirectoryItem = this.addDirectoryItem.bind(this); this.removeDirectoryItem = this.removeDirectoryItem.bind(this); this.onResetConfiguration = this.onResetConfiguration.bind(this); this.onClearAllCaches = this.onClearAllCaches.bind(this); this.loadConfig = this.loadConfig.bind(this); } @@ -143,6 +144,16 @@ } } onClearAllCaches() { fetch(getRestServiceUrl("configuration/clearAllCaches"), { method: "GET", dataType: "JSON", headers: { "Content-Type": "text/plain; charset=utf-8" } }) } addDirectoryItem() { directoryItems.push({ index: directoryItems.length + 1, @@ -163,12 +174,16 @@ } if (this.state.failed) { return <ErrorAlertGenericRestFailure handleClick={this.loadConfig} />; return <ErrorAlertGenericRestFailure handleClick={this.loadConfig}/>; } return ( <form> <FormLabelField> <FormButton id={'clearCahces'} onClick={this.onClearCaches}> Clear all caches </FormButton> </FormLabelField> <FormLabelField> <Button className={'btn-outline-primary'} onClick={() => this.setState({expertSettingsOpen: !this.state.expertSettingsOpen})}> <IconWarning/> <I18n name={'configuration.forExpertsOnly'}/>