Asp.NetʹÓÃCache
ÐÄÓêÖ®¼Ò
Cache ¼´¸ßËÙ»º´æ £¬ÎÒÏëºÜ¶àÈ˶ÔËûµÄµÚÒ»Ó¡ÏóÒ»¶¨ÏñÎÒÒ»Ñù£¬¸Ð¾õËûÒ»¶¨ÄÜÌá¸ßϵͳµÃÐÔÄܺÍÔËÐÐËٶȡ£µÄÈ·¡£NetÍƳöcacheµÄ³õÖÔȷʵÊÇÕâÑùµÄ¡£ÄÇôcacheÊÇÈçºÎÌá¸ßϵͳÐÔÄÜÓëÔËÐÐËÙ¶ÈÄØ£¿ÊDz»ÊÇÔÚÈκÎÇé¿öÏÂÓÃcache¶¼ÄÜÌá¸ßÐÔÄÜ£¿ÊDz»ÊÇcacheÓõÄÔ½¶à¾ÍÔ½ºÃÄØ£¿ÎÒÔÚ½üÆÚ¿ª·¢µÄÏîÄ¿ÖÐÓÐËùÌå»á£¬Ð´ÏÂÀ´µ±×÷×ܽáҲϣÍûÄܸú´ó¼ÒÒ»Æð̽ÌÖ̽ÌÖ£¬ÓдíÎóµÄµØ·½Ï£Íû´ó¼ÒÅúÆÀÖ¸Õý¡£
1. Cache ÊÇÈçºÎ¹¤×÷µÄ¡£
l Cache ÊÇ·ÖÅäÔÚ·þÎñÆ÷ÉϵÄÒ»¸ö¹«¹²µÄÄÚ´æƬ¡£
Ëùν¹«¹²Ö¸µÄcacheÖ»ÒªÒ»´´½¨ÊÇÈκÎÒ»¸ö¿Í»§¶Ëä¯ÀÀÆ÷¶¼¿ÉÒÔͨ¹ýºǫ́´úÂë·ÃÎʵ½Ëü£¬ËüÃæÏòµÄÊÇËùÓÐÓû§£¬Ïà¶Ô¶øÑÔsessionÒ²ÊÇ·þÎñÆ÷ÉϵÄÒ»¶ÎÄڴ棬µ«ËûÃæÏòµÄÊǵ¥¸öÓû§¡£ËüÊÇ·þÎñÆ÷µÄÒ»¶ÎÄÚ´æ¿é£¬Ò²¾ÍÊÇ˵ÿ¸öcacheÒ»¾´´½¨¾ÍÕ¼ÓÃÁË·þÎñÆ÷×ÊÔ´µÄ¡£ËùÒÔ´ÓÕâµãÀ´ËµÎÒÃǾͿÉÒÔ˵£º²¢²»ÊÇcacheÔ½¶àÔ½ºÃ¡£
l cache ÊÇÓÐʱ¼äÏÞÖƵģ¬³¬¹ýÁË·þÎñÆ÷É趨µÄ¹ýÆÚʱ¼ä£¬Ëü¾Í»á±»·þÎñÆ÷»ØÊÕ¡£
l c.cache ¿ÉÒÔ´æ·ÅÈκζÔÏó
2. Cache ÈçºÎ´´½¨ÒÔ¼°ÈçºÎÏú»Ù¡£
l ´´½¨cache
ÔÚ¡£Net»·¾³ÏÂͨ¹ýCache.Insert(string key,object o)·½·¨´´½¨¡£ÆäÖÐkey ´ú±ícacheµÄID,o´ú±í´æµ½cacheÀïµÄ¶ÔÏó¡£
l Ïú»Ùcache.
ͨ¹ý·½·¨Cache.Remove(string key)ÆäÖÐkey ´ú±ícacheµÄ ID.
l µ÷ÓÃcache.
CacheÖ§³Ö×°Ïä/²ðÏä²Ù×÷¡£ÈçÄã¿ÉÒÔ°ÑÒ»¸öDataSet¶ÔÏódsͨ¹ýCache.Insert(“dsCache”,ds)µÄ·½Ê½´æµ½CacheÖУ¬¿ÉÒÔͨ¹ý²ðÏä²Ù×÷ DataSet ds = (DataSet)Cache[“dsCache”]À´·ÃÎÊËü¡£
3. ʲôʱºòÓÃcache.
Cache Ò»°ãÓÃÓÚÊý¾Ý½Ï¹Ì¶¨£¬ÓõĽÏƵ·±µÄµØ·½¡£ÀýÈç¿ÉÒ԰ѽøÏú´æϵͳÖпÉÒ԰ѲúÆ·ÐÅÏ¢´æÈëcache,ÔÚÓû§µ÷ÓòúÆ·ÐÅϢʱͨ¹ýµ÷ÓÃcache¼´¿É£¬ÕâÑù´ÓºÜ´ó³Ì¶ÈÉϼõÉÙÁËÓû§ÓëÊý¾Ý¿âµÄ½»»¥£¬Ìá¸ßÁËϵͳµÄÐÔÄÜ¡£·´Ö®£¬cache²»ÊʺÏÓÃÔÚÊý¾Ý±ä¶¯¿ì£¬Ê¹Ó÷¶Î§ºÜյĵط½¡£ÀýÈç°ÑÒ»¸ö¾ßÌå²É¹ºµ¥´æÈë cacheÖС£
4. cache µ÷ÓÃ×¢ÒâÊÂÏî¡£
CacheÊÇÓÐʱ¼
Ïà¹ØÎĵµ£º
Ïã¸ÛÄDZ߹«Ë¾µÄÊг¡²¿¿ª»áʱҪÇóÎÒÃÇÕâ±ßʵÏÖÒ»¸ö¶¨Ê±·¢ËÍÓʼþµÄ¹¦ÄÜ£¬¼´ÔÚÿÌìÏÂÎç5µã×óÓÒ¶¨Ê±°Ñ½ñÌìÒÑͨ¹ýÈýÉóµÄ¶©µ¥ÐÅÏ¢·¢¸øÊг¡²¿µÄ¾Àí£¬¸æËßËûÄÄЩ¶©µ¥ÒѾͨ¹ýÁËÖÕÉó¡£Æ½Ê±Ö»ÖªµÀÈçºÎÓÃ.net·¢ËÍÓʼþ£¬µ«²»ÖªÈçºÎ¶¨Ê±·¢ËÍÓʼþ¡£ÓÚÊÇ°Ù¶ÈÁËһϣ¬×ܽáÆðÀ´ÓÐÒÔÏÂÄÇôÈýÖÖ£º
£¨1£©×öÒ»¸öwinform À´¶¨Ê±·¢Óʼþ¡£È»ºóͨ¹ý ......
ÔÚÇ°ÃæµÄ¼¸ÆªÎÄÕÂÖнéÉÜÁËasp.netµÄ´°ÌåÉí·ÝÑéÖ¤£¬ÕâÖÖÉí·ÝÑéÖ¤·½Ê½¿ÉÒÔÈÃͨ¹ýÑéÖ¤µÄÓû§·ÃÎÊÖ¸¶¨µÄĿ¼£¬¶øûÓÐͨ¹ýÑéÖ¤µÄÓû§²»ÄÜ·ÃÎʸÃĿ¼ÏµÄÍøÒ³¡£
µ«ÊÇ£¬ÓÐÒ»ÖÖÀýÍ⣬¾ÍÊÇĿ¼ÖеÄhtmlÎļþÀýÍâ¡£ÀýÈ磬ÔÚ¡¶asp.netÖеĴ°ÌåÉí·ÝÑéÖ¤£¨×î¼òµ¥Æª£©¡·ÖнéÉܵģ¬³ýÁ˵ǼÍøÒ³Ö®Íâ ......
Ò»£¬»ñµÃMircosoft URLRewriter.dll£º
»ñµÃMircosoft URLRewriter.dll¿ÉÒÔµ½http://www.microsoft.com/china/msdn/library/webservices/asp.net/URLRewriting.mspx?mfr=true
ÏÂÔØÍê±Ïºó£¬µ¼È빤³Ì£¬ÎÒÕâÀïûÓжԸù¤³Ì×öÈκÎÐ޸ģ¬±£ÁôÁËÔÀ´µÄÖØд·½Ê½£¬È»ºóÖ±½ÓÔÚVS2005ÀïÃæÉú³É.dllÎļþ¾Í¿ÉÒÔÁË¡£
¶þ£¬Ê¹ÓøÃdl ......
µÚÒ»ÖÖ·½·¨£º
ͨ¹ýURLÁ´½ÓµØÖ·´«µÝ
send.aspx:
protected void Button1_Click(object sender, EventArgs e)
{
Request.Redirect("Default2.aspx?username=honge");
&n ......