impl of cachematrix