MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / initPurgeTicker

Method initPurgeTicker

internal/caches/storage_memory.go:656–676  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

654}
655
656func (this *MemoryStorage) initPurgeTicker() {
657 var autoPurgeInterval = this.policy.MemoryAutoPurgeInterval
658 if autoPurgeInterval <= 0 {
659 autoPurgeInterval = 5
660 }
661
662 // 启动定时清理任务
663
664 if this.purgeTicker != nil {
665 this.purgeTicker.Stop()
666 }
667
668 this.purgeTicker = utils.NewTicker(time.Duration(autoPurgeInterval) * time.Second)
669 goman.New(func() {
670 for this.purgeTicker.Next() {
671 var tr = trackers.Begin("MEMORY_CACHE_STORAGE_PURGE_LOOP")
672 this.purgeLoop()
673 tr.End()
674 }
675 })
676}

Callers 2

InitMethod · 0.95
UpdatePolicyMethod · 0.95

Calls 7

purgeLoopMethod · 0.95
NewTickerFunction · 0.92
NewFunction · 0.92
BeginFunction · 0.92
NextMethod · 0.80
StopMethod · 0.65
EndMethod · 0.45

Tested by

no test coverage detected