Added cache api middleware to allow pre-loading cache