Implement the cache system.