matrix cache method