CacheMatrix  solution