move code into cache_tool