Libtransport: Move message caching to one method