Implement cahceMatrix