Improving getTemp function speed through caching.