Implemented a cache mechanism