Fix the cache check
Added a new variable that allows the user to control the cache refresh time