Add support for caching warnings and errors. Resolves #1.