简体   繁体   English

按变量值的ASP.NET用户控件部分缓存

[英]ASP.NET User Control Partial Caching by variable values

How is it possible to create various cached versions of a user control based on a field within the control. 如何根据控件中的字段创建用户控件的各种缓存版本。 So for example I have a user control that has the following declaration: 因此,例如,我有一个具有以下声明的用户控件:

int someInt = 0;

Let's say this variable could be set to any value between 1 and 10. If I want a separate cached user control for each value of the variable - how do I achieve this? 假设该变量可以设置为1到10之间的任何值。如果我想为变量的每个值使用单独的缓存用户控件-如何实现此目的?

What you need is VaryByControl. 您需要的是VaryByControl。 See 看到

Vary by control properties using PartialCaching in ASP.NET 使用ASP.NET中的PartialCaching随控件属性而变化

for details. 有关详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM