Implement matrix cache functions