refactored cache classes so we can move it to a separate repository