A second pass at #579, optimizing by doing deletion during cache rebuild