Add merge cache logic