Code for storing cache for an inverse of a square matrix

This is my code for solving the inverse of a square matrix and storing
it as cache for later use.