Use cache from settings not middleware

for some reason middleware was returning a memory cache incorrectly