Solution for caching matrix plus test-case.