DonutCache is not removing cache for child action

Oct 29, 2013 at 11:55 AM
i am using DonutCaching to cache ChildActionOutput and its working fine but when i am trying to remove the object from cache it not removing it.

i have gone through many post but it didnt work.

posts : DonutOutputCache is not clearing cache when using variable

My Code

[DonutOutputCache(Duration = 600, VaryByParam = "trainerid")]
public ViewResult ProfileContainer(int trainerid)
    var model = new ProfileContainerViewModel {TrainerId = trainerid};
    return View("Profile/ProfileContainerPartial", model);
"Profile/ProfileContainerPartial" view further contains many child action and i am assuming that if we cache the parent view it will by default cache inner views.

but when i am refreshing the cache it not working

below is the code to refresh the cache

public JsonResult MyProfile(EditProfileRequestModel requestModel)
    var cacheManager = new OutputCacheManager();
    cacheManager.RemoveItem("TrainerProfileContainer", "Account");
    var output = AjaxResult.GetSuccessAjaxResult("");
    output.ReturnedObject =
            Message = "Profile Updated Successfully"
    return Json(output);