【发布时间】:2011-07-25 08:53:57
【问题描述】:
我正在开发一个网站,在该网站中,每种类型的用户 ({guest,loggedIn}) 都可以查看不同文化 ({en-US...}) 的 [N] 个页面。我正在使用 GetVaryByCustomString 来处理每个页面的缓存:
Public Overrides Function GetVaryByCustomString(ByVal currentContext As HTTPContext, ByVal customArgs As String) As String
Select Case customArgs
Case "userAndCulture"
Return String.Format("{0}{1}", Languages.getLanguageID(), User.getUserID(0))
End Select
Return MyBase.GetVaryByCustomString(currentContext, customArgs)
End Function
注意:getUserID() 具有 DBNull.Value 的默认“returnValueWhenNull”(它用于大部分工作的 SQL),所以我发送 0(零),所以所有客人都将拥有相同的页面。
但是,我的主要问题是:这种机制不会在内存方面杀死服务器吗?我的意思是,没有潜在的 [loggedInUsersCount] * [culturesCount] * [pagesCount] 页吗?
另一个注意事项:页面仅缓存在服务器内存中
【问题讨论】:
标签: asp.net performance caching memory localization