I have web user control, it handles some potentially intensive data calculations, and I would like it to be displayed in the cache so that every page view does not recount the data. It is located on very frequently viewed pages, so it is very important that I work correctly!
For context, it was used in our arcade:
http://www.scirra.com/arcade/action/93/8-bits-runner
Click on statistics, data for graphs and statistics are created from this webusercontrol.
The start of management is as follows:
public partial class Controls_Arcade_Data_ArcadeChartData : System.Web.UI.UserControl
{
public int GameID { get; set; }
public Arcade.ChartDataType.ChartType Type { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
Now the difficulty that I am facing is that the output cache must depend on both GamID and ChartType.
GameID , , , .
, GameID = 93 Type = GraphData, GameID = 41 Type = TotalPlaysData, GameID = 93, Type = TotalPlaysData. .
( )
<div>Total Plays:</div>
<div class="count"><Scirra:ArcadeChartData runat="server" GameID="93" Type="TotalPlays" /></div>
<br /><br />
<div>Total Guest Plays:</div>
<div class="count"><Scirra:ArcadeChartData runat="server" GameID="93" Type="TotalGuestPlays" /></div>
etc.
! , -, , , .
Edit
: : <% @OutputCache Duration = "20" VaryByControl = "GameID; " % >
Object reference not set to an instance of an object. , GameID ASPX .