Implemented cache functions and simple test