Initial impl of matrix cache functions.