Added middleware toggle as 2nd param for caching middleware