An injectable and biocompatible hydrogel loaded with both Indoleamine 2, 3-dioxygenase 1 (IDO1) inhibitor and herpes simplex virus type 1 (HSV-1) displays synergistic anti-cancer effects in vivo by remodeling the tumor microenvironment and generating immune memory effects. Here, IDO1 is linked to cancer.