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

Method Close

internal/caches/open_file_cache.go:125–148  ·  view source on GitHub ↗
(filename string)

Source from the content-addressed store, hash-verified

123}
124
125func (this *OpenFileCache) Close(filename string) {
126 filename = filepath.Clean(filename)
127
128 this.locker.Lock()
129
130 pool, ok := this.poolMap[filename]
131 if ok {
132 // 设置关闭状态
133 pool.SetClosing()
134
135 delete(this.poolMap, filename)
136 this.poolList.Remove(pool.linkItem)
137 _ = this.watcher.Remove(filename)
138 this.count -= pool.Len()
139 this.usedSize -= pool.usedSize
140 }
141
142 this.locker.Unlock()
143
144 // 在locker之外,提升性能
145 if ok {
146 pool.Close()
147 }
148}
149
150func (this *OpenFileCache) CloseAll() {
151 this.locker.Lock()

Callers 1

Calls 7

SetClosingMethod · 0.80
RemoveMethod · 0.65
CloseMethod · 0.65
CleanMethod · 0.45
LockMethod · 0.45
LenMethod · 0.45
UnlockMethod · 0.45

Tested by 1