Updated APIPinningMiddleware to use the cache backend

I thought I'd play with this based on the email thread. This could use some good eyeballs.