()
| 1556 | } |
| 1557 | |
| 1558 | func (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 | |
| 1577 | func (this *FileStorage) runMemoryStorageSafety(f func(memoryStorage *MemoryStorage)) { |
| 1578 | var memoryStorage = this.memoryStorage // copy |
no test coverage detected