mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-12-15 09:18:59 +08:00
28 lines
434 B
Go
28 lines
434 B
Go
|
package job
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"github.com/1Panel-dev/1Panel/agent/global"
|
||
|
)
|
||
|
|
||
|
type Cache struct{}
|
||
|
|
||
|
func NewCacheJob() *Cache {
|
||
|
return &Cache{}
|
||
|
}
|
||
|
|
||
|
func (c *Cache) Run() {
|
||
|
global.LOG.Info("run cache gc start ...")
|
||
|
ticker := time.NewTicker(5 * time.Minute)
|
||
|
defer ticker.Stop()
|
||
|
for range ticker.C {
|
||
|
again:
|
||
|
err := global.CacheDb.RunValueLogGC(0.7)
|
||
|
if err == nil {
|
||
|
goto again
|
||
|
}
|
||
|
}
|
||
|
global.LOG.Info("run cache gc end ...")
|
||
|
}
|