How do i use cache in MVC so it only gets the new chart once per day.
Here is some info:
I am getting xignite feed and I am creating the chart:
To display the chart in ColumnsThree.cshtml
I am writing this:
<img src="@Url.Action("MyChart")" alt="" />
I am writing the code in BaseNopController.cs
public ActionResult MyChart()
{
try
{
// Build Chart
var chart = new Chart()
{
Height = 180,
Width = 300,
//BackGradientStyle = GradientStyle.TopBottom,
//BackColor = Color.Gray,
//BorderSkin = new BorderSkin() { SkinStyle = BorderSkinStyle.Emboss }
};
// Add Chart Area and Set 3-D Settings
chart.ChartAreas.Add(new ChartArea());
XigniteMetals objMetalsService;
objMetalsService = new XigniteMetals();
xigniteMetalsSvc.HistoricalChart objHistoricalMetalQuote;
ChartDesign cd = new ChartDesign();
cd.TextTitle = "";
cd.FormatDate = "MM/yy";
...
objHistoricalMetalQuote = objMetalsService.GetMetalSpotChartCustom(xigniteMetalsSvc.MetalTypes.XAU,
xigniteMetalsSvc.MetalCurrencyTypes.USD, DateTime.Now.AddDays(-365).ToString("MM/dd/yyyy"), DateTime.Now.AddDays(-1).ToString("MM/dd/yyyy"), xigniteMetalsSvc.StockChartStyles.Line, 320, 210, cd);
return new ChartActionResult(chart);
}
I will appreciate if someone can guide how do I call mychart only once per day otherwise where do I save that chart and get it from cache in nopcommerc v2.4