Cache class

Created a class to deal with data caching.