Implement the cache simulator.