This adds some unit tests to exercise the image cache middleware. Two new functions were also created in the cache middleware itself to make it more testable. Change-Id: Iea67119622461f1e8116b2a6913f94ca4eb22607