working example of a matrix cache