First cut at porting the cache code, no tests ported yet.