MCPcopy Create free account
hub / github.com/astercloud/aster / cleanupExpiredCache

Method cleanupExpiredCache

pkg/security/access_control.go:1012–1026  ·  view source on GitHub ↗

cleanupExpiredCache 清理过期缓存

()

Source from the content-addressed store, hash-verified

1010
1011// cleanupExpiredCache 清理过期缓存
1012func (ac *AccessController) cleanupExpiredCache() {
1013 if ac.cache == nil {
1014 return
1015 }
1016
1017 ac.cache.mu.Lock()
1018 defer ac.cache.mu.Unlock()
1019
1020 now := time.Now()
1021 for key, entry := range ac.cache.entries {
1022 if now.After(entry.expiredAt) {
1023 delete(ac.cache.entries, key)
1024 }
1025 }
1026}
1027
1028// AccessCache 缓存方法
1029func (cache *AccessCache) get(key string) *CacheEntry {

Callers 1

startCleanupWorkerMethod · 0.95

Calls 1

deleteFunction · 0.85

Tested by

no test coverage detected