Change os.rename to shutil.move to atomically move the cache_file

If the cache_directory (/var/tmp) is on a different filesystem
than the file created with tempfile.mkstemp, the os.rename
will fail.  shutil.move catches and corrects for this error
for us.