日期:2014-05-18  浏览次数:20427 次

请问如何清空WEB程序的所有缓存
在前台的页面中有使用大量页面缓存...现在我想在后台的管理中加一项功能.就是清空所有缓存..前台在访问时就重新读取新的数据...请问如何办到

我有想过用什么缓存依赖.但我的数据库是access不是sql

------解决方案--------------------
不太懂。
------解决方案--------------------
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 );
}
------解决方案--------------------
或者用代码修改一下 web.config
------解决方案--------------------
学习ing..
------解决方案--------------------
或者用代码修改一下 web.config

这个会导致不仅仅缓存丢失吧
------解决方案--------------------
学习

帮顶一下
------解决方案--------------------
cache.Remove();不能用吗?

------解决方案--------------------
foreach(xxx in array(aaa))
{
cache.Remove(xxx);
}