Ocean/ICCC/InitCacheTimer.go
2015-07-10 14:36:47 +02:00

30 lines
450 B
Go

package ICCC
import (
"time"
)
// Setup and starts the cache timer.
func initCacheTimer() {
startCacheTimerLock.Lock()
defer startCacheTimerLock.Unlock()
if cacheTimerRunning {
return
} else {
cacheTimerRunning = true
}
// Start another thread with the timer-logic:
go func() {
// Endless loop:
for {
// Execute the logic:
cacheTimerLogic()
// Wait five minutes:
time.Sleep(time.Duration(5) * time.Minute)
}
}()
}