Add caching for partials

@simen Would you sanity check this?