Add a cache mechanism to store database results