Middleware for expiring cached content after the given time