PLD: add caching to middleware