Implemented function cachemartix and getcachematrix