今天终于看了一下CACHE ,一点学习心得与大家一起分享.也请大家指教. public class HttpRuntimeCache { public static string Instance() { string vc=(string)HttpRuntime.Cache["Test"]; if(vc==null) { HttpRuntime.Cache.Add("Test","test", null,System.DateTime.Now.AddDays(10),TimeSpan.Zero, CacheItemPriority.Default,null); } return vc; } }
1public class hashcache 2 { 3 private static Hashtable parmCache = Hashtable.Synchronized(new Hashtable()); 4 5 public static void CacheParameters(string cacheKey, string cmdParms) 6 { 7 parmCache[cacheKey] = cmdParms; 8 } 9 10 public static string GetCachedParameters(string cacheKey) 11 { 12 return (string)parmCache[cacheKey]; 13 } 14 }
|
|
来自: estorm2008 > 《DotNet》