晨鸟科技

标题: System.Web.Caching [打印本页]

作者: Star    时间: 2010-12-29 16:41
标题: System.Web.Caching
  1. public void AddItemToCache(Object sender, EventArgs e) {) ^4 j4 i" _2 y( m. I
  2.     itemRemoved = false;
    $ t& |8 w3 F1 }. Z! o" V3 r

  3. * a' S" o6 x: C, L
  4.     onRemove = new CacheItemRemovedCallback(this.RemovedCallback);
    6 }2 S- L# S2 l! ^' X
  5. ) l6 a) B: z4 E; ]5 E; `$ Q/ V/ n
  6.     if (Cache["Key1"] == null)
    - @# s' @% K8 I! v4 r
  7.       Cache.Add("Key1", "Value 1", null, DateTime.Now.AddSeconds(60), TimeSpan.Zero, CacheItemPriority.High, onRemove);
    , L; @$ ^3 }' ^0 g
  8. }
复制代码
详见:http://msdn.microsoft.com/zh-cn/ ... b.caching.cache.add(VS.80).aspx




欢迎光临 晨鸟科技 (http://www.chenniao.com/cprofessor/) Powered by Discuz! X3.2