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

Method initOpenFileCache

internal/caches/storage_file.go:1558–1575  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1556}
1557
1558func (this *FileStorage) initOpenFileCache() {
1559 var err error
1560
1561 var oldOpenFileCache = this.openFileCache
1562
1563 // 启用新的
1564 if this.options.OpenFileCache != nil && this.options.OpenFileCache.IsOn && this.options.OpenFileCache.Max > 0 {
1565 this.openFileCache, err = NewOpenFileCache(this.options.OpenFileCache.Max)
1566 if err != nil {
1567 remotelogs.Error("CACHE", "open file cache failed: "+err.Error())
1568 }
1569 }
1570
1571 // 关闭老的
1572 if oldOpenFileCache != nil {
1573 oldOpenFileCache.CloseAll()
1574 }
1575}
1576
1577func (this *FileStorage) runMemoryStorageSafety(f func(memoryStorage *MemoryStorage)) {
1578 var memoryStorage = this.memoryStorage // copy

Callers 2

UpdatePolicyMethod · 0.95
InitMethod · 0.95

Calls 4

ErrorFunction · 0.92
NewOpenFileCacheFunction · 0.85
CloseAllMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected