ÀûÓÃCache£¬asp.net ¼òµ¥ÊµÏÖ¶¨Ê±Ö´ÐÐÈÎÎñ
private
static
CacheItemRemovedCallback OnCacheRemove
=
null
;
protected
void
Application_Start(
object
sender, EventArgs e)
{
AddTask(
"
DoStuff
"
,
60
);
}
private
void
AddTask(
string
name,
int
seconds)
{
OnCacheRemove
=
new
CacheItemRemovedCallback(CacheItemRemoved);
HttpRuntime.Cache.Insert(name, seconds,
null
,
DateTime.Now.AddSeconds(seconds), Cache.NoSlidingExpiration,
CacheItemPriority.NotRemovable, OnCacheRemove);
}
public
void
CacheItemRemoved(
string
k,
object
v, CacheItemRemovedReason r)
{
//
do stuff here if it matches our taskname, like WebRequest
//
re-add our task so it recurs
AddTask(k, Convert.ToInt32(v));
}
Ïà¹ØÎĵµ£º
ÔÚÒ³Ãæ¼äÌøת,»áÉæ¼°µ½ÖµºÍÊý¾ÝµÄ´«µÝÎÊÌâ.ÌØÓñ¾ÎĽ«ÎÒÖªµÀµÄһЩ·½·¨¹éÄÉÒ»ÏÂ.
1.´ø²ÎÊý´«µÝ
Óŵã:ʹÓ÷½±ã
ȱµã:°²È«ÐÔµÍ,Êʺϴ«µÝ¼òµ¥ÀàÐ͵ĶÔÏó,±ÈÈçÊý×Ö.×Ö·û.µ«¶Ô¶ÔÏó.Êý×éµÈ²»ºÏÊÊ´«µÝ.
Ó¦ÓÃ:
a.°²È«ÐÔ²»¸ß,Ó¦¶Ô·½Ê½:¶Ô´«µÝµÄÖµ½øÐмÓÃÜ.
b.´«µÝ¼òµ¥ÀàÐ͵ĶÔÏó.Ó¦¶Ô·½Ê½:ÔÚ´«µÝҳͨ¹ý¼òµ¥ÀàÐͶÔÏó¸ø³ö±êʶ,ÔÚ ......
1¡¢aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TransferMoney.aspx.cs" Inherits="BtmsWebApp.report.TransferMoney" MasterPageFile="~/ReportPage.master" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d5 ......
+++ ASP.NET»º´æÖеÄÊý¾ÝÊDz»Îȶ¨µÄ£¬²»»á±»ÓÀ¾ÃµØ´æ´¢£¬¿ÉÄÜ»áÓÉÓÚÒÔÏÂÔÒòÖ®Ò»¶ø´Ó»º´æÖб»×Ô¶¯ÒƳý£º
1) »º´æÂúÁË
2) »º´æÏîÒѾ¹ýÆÚ
3) »º´æÒÀÀµµÄÏî¸Ä±äÁË
+++ ³ýÁË¿ÉÒÔ×Ô¶¯ÒƳý»º´æÏîÍ⣬Äã¿ÉÒÔÏÔʾÒƳý»º´æÏî¡£ÁíÍ⣬µ±ÄãÓÃInsert·½·¨ºÍAdd·½·¨Ïò»º´æÖÐÌí¼ÓµÄ»º´æÏîÒѾ´æÔÚʱ£¬ÄÇô£¬ÔÀ´µÄ»º´æÏ±»×Ô¶¯É¾³ý¡ ......
+++ Ò³Ãæ´úÂëÈçÏ£º
<asp:Button ID="Button1" runat="server" Text="Ìí¼Ó¿ÕÐÐ" OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="±£´æËùÓÐ" OnClick="Button2_Click" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="403px">
......
+++ Ò³Ãæ´úÂëÈçÏ£º
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="username" DataSourceID="SqlDataSource1"
PageSize="3">
<Columns>
  ......