mvcdonutcaching icon indicating copy to clipboard operation
mvcdonutcaching copied to clipboard

how to set duration programmatically

Open amirjelo opened this issue 10 years ago • 2 comments

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?

amirjelo avatar Jan 02 '15 12:01 amirjelo

Can you upload a test project so that I can reproduce the issue or tell you what is wrong ?

moonpyk avatar Mar 27 '15 15:03 moonpyk

@amir-yeketaz We needed something similar, and it worked for us. So it should be possible.

migig avatar Sep 25 '15 13:09 migig