mirror of https://github.com/1Panel-dev/1Panel
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
435 B
27 lines
435 B
package job
|
|
|
|
import (
|
|
"github.com/1Panel-dev/1Panel/backend/global"
|
|
"time"
|
|
)
|
|
|
|
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 ...")
|
|
}
|