Cache validation result.

Rebased version of #303/#290
Remove this change please since its unrelated.