Cache对文件依赖的问题?
我建有2个Cache项,一个"txt2",依赖文件myfile.xml,另一个"txt",依赖文件myfile.txt
现在我去修改文件myfile.xml和myfile.txt
可是我的Cache项"txt2"被删除了,Cache项"txt"还存在
这是什么会事情,我认为应该2个Cache项都要被删除
是不是Cache项依赖文件必须是XML文件?
其它格式的文件如果有做依赖文件,是否有什么要求?
代码
string FilePath=MapPath("myfile.xml");
SqlConnection con=new SqlConnection("Uid=sa;database=pubs;");
SqlDataAdapter da =new SqlDataAdapter("select * from authors",con);
DataSet ds=new DataSet();
da.Fill(ds);
System.Web.Caching.CacheDependency CacheDependencyXmlFile=
new System.Web.Caching.CacheDependency(FilePath);
Cache.Insert("txt2",ds ,CacheDependencyXmlFile);
string FilePath=MapPath("myfile.txt");
SqlConnection con=new SqlConnection("Uid=sa;database=pubs;");
SqlDataAdapter da =new SqlDataAdapter("select * from authors",con);
DataSet ds=new DataSet();
da.Fill(ds);
System.Web.Caching.CacheDependency CacheDependencyXmlFile=
new System.Web.Caching.CacheDependency(FilePath);
Cache.Insert("txt",ds ,CacheDependencyXmlFile);