Finished the cache implementation