Skip to content

Instantly share code, notes, and snippets.

@matthewbednarski
Created August 21, 2014 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewbednarski/d9c8d8a24e3040cc2555 to your computer and use it in GitHub Desktop.
Save matthewbednarski/d9c8d8a24e3040cc2555 to your computer and use it in GitHub Desktop.
clear scm-manager's caches
// taken from
// https://groups.google.com/forum/#!topic/scmmanager/tvfhJWDlTO8
// requires the scm-manager plugin scm-script-plugin
import sonia.scm.*;
import sonia.scm.cache.*;
import sonia.scm.repository.*;
import sonia.scm.repository.api.*;
import sonia.scm.activity.ActivityManager;
import sonia.scm.activity.ActivitySet;
import sonia.scm.activity.Activities;
def cacheManager = injector.getInstance(CacheManager.class);
def caches = [
cacheManager.getCache(BlameCommandBuilder.CacheKey.class, BlameResult.class, BlameCommandBuilder.CACHE_NAME),
cacheManager.getCache(BrowseCommandBuilder.CacheKey.class, BrowserResult.class, BrowseCommandBuilder.CACHE_NAME),
cacheManager.getCache(LogCommandBuilder.CacheKey.class, ChangesetPagingResult.class, LogCommandBuilder.CACHE_NAME),
cacheManager.getCache(TagsCommandBuilder.CacheKey.class, Tags.class, TagsCommandBuilder.CACHE_NAME),
cacheManager.getCache(BranchesCommandBuilder.CacheKey.class, Branches.class, BranchesCommandBuilder.CACHE_NAME),
cacheManager.getCache(String.class, ActivitySet.class, ActivityManager.CACHE_REPOSITORY),
cacheManager.getCache(String.class, Activities.class, ActivityManager.CACHE_USER)
];
for (def cache : caches){
cache.clear();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment