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

Method CleanPrefix

internal/caches/list_memory.go:110–123  ·  view source on GitHub ↗

CleanPrefix 根据前缀进行清除

(prefix string)

Source from the content-addressed store, hash-verified

108
109// CleanPrefix 根据前缀进行清除
110func (this *MemoryList) CleanPrefix(prefix string) error {
111 this.locker.RLock()
112 defer this.locker.RUnlock()
113
114 // TODO 需要优化性能,支持千万级数据低于1s的处理速度
115 for _, itemMap := range this.itemMaps {
116 for _, item := range itemMap {
117 if strings.HasPrefix(item.Key, prefix) {
118 item.ExpiresAt = 0
119 }
120 }
121 }
122 return nil
123}
124
125// CleanMatchKey 清理通配符匹配的缓存数据,类似于 https://*.example.com/hello
126func (this *MemoryList) CleanMatchKey(key string) error {

Callers 1

Calls 2

RLockMethod · 0.80
RUnlockMethod · 0.80

Tested by 1