mvcdonutcaching
mvcdonutcaching copied to clipboard
how to set duration programmatically
i want to change the duration of DonutOutputCache attribute from database record.
so i just write a custom outputcache which is childof DonutOutputCacheAttribute : public class CmsOutputCache : DonutOutputCacheAttribute { public CmsOutputCache() { var setting = SettingBL.GetAdvancedSetting(); this.Duration = setting.TimeCache * 15;
}
}
and use it like this : [ChildActionOnly] [CmsOutputCache] public ActionResult HeaderSlider(){}
but the behavior of caching not working now! how to set duration?
Can you upload a test project so that I can reproduce the issue or tell you what is wrong ?
@amir-yeketaz We needed something similar, and it worked for us. So it should be possible.