Solution for cachematrix