Thread-safe cache for Excel workbook instances to avoid file contention and improve performance.
This cache uses weak references to allow workbooks to be garbage collected when no longer needed, while providing significant performance improvements when multiple operations access the same Excel file.
Explicitly close and remove a workbook from the cache.
Explicitly close and remove a workbook from the cache.
This method should be called when you know a workbook will no longer be needed to free up resources immediately rather than waiting for garbage collection.
Get or create a workbook for the specified file path.
Get or create a workbook for the specified file path.
This method is thread-safe and will reuse existing workbook instances when possible. If a workbook is garbage collected, a new one will be created automatically.
Value parameters
filePath
The absolute path to the Excel file
Attributes
Returns
A Try containing the Workbook instance, or a Failure if the file cannot be opened