我如何'甜甜圈缓存“在ASP.NET MVC的东西比一个更日期 [英] How do I 'donut cache' in ASP.NET MVC for something more than a date

查看:108
本文介绍了我如何'甜甜圈缓存“在ASP.NET MVC的东西比一个更日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有的例子都只是这样的:

All the examples for donut caching I've seen are just like this :

 <%= Html.Substitute( c => DateTime.Now.ToString() )%>

多数民众赞成罚款,如果我只是想日期,但什么其他的选择有哪些?

Thats fine if I just want the date, but what other options are there?

我知道有一个具有以下签名的委托MvcSubstitutionCallback

I know there is a delegate 'MvcSubstitutionCallback' which has the following signature :

 public delegate string MvcSubstitutionCallback(HttpContextBase httpContext);

的RenderAction 的RenderPartial 返回void,所以我不能只是从委托方式回报他们。我怎样才能有效地使用此回调更复杂的情况。

but RenderAction and RenderPartial returns void so i cant just return them from the delegate method. How can I effectively use this callback for more complex situations.

我已经看了两个菲尔Haacked的文章这里这里,但也似乎做正是我想要的。

I've looked at both of Phil Haacked's articles here and here, but neither seems to do exactly what I want.

推荐答案

本文章可能会有所帮助:的 http://www.asp.net/Learn/mvc/tutorial-19-cs.aspx (添加在ASP.NET MVC动态内容到缓存的页面)

This article might be helpful: http://www.asp.net/Learn/mvc/tutorial-19-cs.aspx (Adding Dynamic Content to a Cached Page in ASP.NET MVC)

这篇关于我如何'甜甜圈缓存“在ASP.NET MVC的东西比一个更日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆