做了个在线考测系统
 把考生的试题放在了服务器端创建的cache中
 当考生点击提交试卷 或着考试结束时候到了后删除cache
  
 我用cache.remove删除 好像没什么效果
   请问大家该如何删除web缓存

解决方案 »

  1.   

    private   Cache   cacheItem; HttpContext   context   =   HttpContext.Current; 
                            if   (   context   !=   null   ) 
                            { 
                                    cacheItem   =   context.Cache; 
                            } 
                            else 
                            { 
                                    cacheItem   =   HttpRuntime.Cache; 
                            } 
      
    IDictionaryEnumerator   CacheEnum   =   cacheItem.GetEnumerator(   ); 
                            ArrayList   al   =   new   ArrayList(   ); 
                            while   (   CacheEnum.MoveNext(   )   ) 
                            { 
                                    al.Add(   CacheEnum.Key   ); 
                            }                         foreach   (   string   key   in   al   ) 
                            { 
                                    cacheItem.Remove(   key   ); 
                            }