Add ability to Flush CollectionFactory. #116

This commit is contained in:
Andrey Smirnov
2015-02-15 23:57:54 +03:00
parent ff00a5a026
commit 0b05964faa
+12
View File
@@ -80,3 +80,15 @@ func (factory *CollectionFactory) PublishedRepoCollection() *PublishedRepoCollec
return factory.publishedRepos return factory.publishedRepos
} }
// Flush removes all references to collections, so that memory could be reclaimed
func (factory *CollectionFactory) Flush() {
factory.Lock()
defer factory.Unlock()
factory.localRepos = nil
factory.snapshots = nil
factory.remoteRepos = nil
factory.publishedRepos = nil
factory.packages = nil
}