Cache validation result.

Rebased version of #303/#290
Great explanation of test setup.