public void saveToCache(String progName, ProgramDB program, boolean replace,
			TaskMonitor monitor) throws IOException, DuplicateNameException, CancelledException {

		if (progName.endsWith(".gzf")) {
			progName = progName.substring(0, progName.length() - 4);
		}

		if (testPrograms.containsKey(progName)) {
			if (!replace) {
				throw new DuplicateNameException(progName + " already cached");
			}
			testPrograms.remove(progName);
		}

		File dbDir = new File(getDbTestDir(), NamingUtilities.mangle(progName) + ".db");

		FileUtilities.deleteDir(dbDir);
		dbDir.mkdirs();

		DBHandle dbh = program.getDBHandle();
		BufferFile bfile = PrivateDatabase.createDatabase(dbDir, null, dbh.getBufferSize());
		program.getDBHandle().saveAs(bfile, true, monitor);

		testPrograms.put(progName, new PrivateDatabase(dbDir));

		Msg.info(this, "Stored unpacked program in TestEnv cache: " + progName);
	}
Save a program to the cached program store.  A SaveAs will be performed on the
program to its cached storage location.

@param progName program name
@param program program object
@param replace if true any existing cached database with the same name will be replaced
@param monitor task monitor
@throws IOException if the database cannot be created
@throws DuplicateNameException if already cached
@throws CancelledException if the save operation is cancelled
Ghidra/Features/Base/src/main/java/ghidra/test/TestProgramManager.java