Description
Bug Description
https://github.com/gofiber/fiber/blob/master/middleware/cache/cache.go#L57 The refactored mutex logic in the cache still blocks other requests. The same mutex is used for retrieving cached values and saving the response of cached API. So, if a slow API is cached, it will block the retrieval of cached values for other APIs.
I don't think the mutex is required here. The memory manager itself has rwMutex lock to prevent race conditions. The only behavioral change without mutex is that for the same key, if multiple requests are made simultaneously the response of the last request will override the first request. But since cache implementation only allows saving GET method responses. I don't think saving first response is of importance.
Expected Behavior
Don't block other requests if cached API is slow.
Fiber Version
v2.36.0
Checklist:
- I agree to follow Fiber's Code of Conduct.
- I have checked for existing issues that describe my problem prior to opening this one.
- I understand that improperly formatted bug reports may be closed without explanation.