Skip to content

Commit

Permalink
Merge pull request #9 from alexwhitman/disable-purge
Browse files Browse the repository at this point in the history
Optionally disable cache purge
  • Loading branch information
lonelycode committed Sep 17, 2014
2 parents 51a9b19 + 15dda05 commit 29e7a90
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions main.go
Expand Up @@ -62,21 +62,26 @@ func setupGlobals() {
AnalyticsStore := RedisStorageManager{KeyPrefix: "analytics-"}
log.Info("Setting up analytics DB connection")

analytics = RedisAnalyticsHandler{
Store: &AnalyticsStore,
}

if config.AnalyticsConfig.Type == "csv" {
log.Info("Using CSV cache purge")
analytics = RedisAnalyticsHandler{
Store: &AnalyticsStore,
Clean: &CSVPurger{&AnalyticsStore}}
analytics.Clean = &CSVPurger{&AnalyticsStore}

} else if config.AnalyticsConfig.Type == "mongo" {
log.Info("Using MongoDB cache purge")
analytics = RedisAnalyticsHandler{
Store: &AnalyticsStore,
Clean: &MongoPurger{&AnalyticsStore, nil}}
analytics.Clean = &MongoPurger{&AnalyticsStore, nil}
}

analytics.Store.Connect()
go analytics.Clean.StartPurgeLoop(config.AnalyticsConfig.PurgeDelay)

if config.AnalyticsConfig.PurgeDelay >= 0 {
go analytics.Clean.StartPurgeLoop(config.AnalyticsConfig.PurgeDelay)
} else {
log.Warn("Cache purge turned off, you are responsible for Redis storage maintenance.")
}
}

//genericOsinStorage = MakeNewOsinServer()
Expand Down

0 comments on commit 29e7a90

Please sign in to comment.