Implementation of cache matrix package