dotnetcore / EasyCaching

:boom: EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
MIT License
1.92k stars 324 forks source link

fix File.Create on Init() not disposed #532

Closed dplarina closed 3 months ago

dplarina commented 3 months ago

I'm not sure why this happens and seems to happen more frequently during debugging but sometimes creating the FileStream in InitCacheKey() for the Disk cache provider will fail with "the file is use" because File.Create(path) returns a FileStream that is not closed/disposed. https://github.com/InspireHUB/EasyCaching/blob/2eb92279d65a3a5f1c9fad1cb4f98344f7c98baa/src/EasyCaching.Disk/DefaultDiskCachingProvider.cs#L167