怎样将一个xmlReader或者xmlDoc 插入到cache中?
我要把一个xmlReader或者xmlDoc 插入到cache中,但是好像插入不进去,或者加入了但我没去出来?以下是代码,每次运行都会打印no read no cache~~为什么啊~到底是我cache.insert没成功呢,还是Cache.Get不成功啊???
Dim xmlReader as XmlTextReader
Dim xmlDoc as XmlDocument= new XmlDocument()
dim updatecache as boolean = false
xmlReader=Cache.Get("cache")
if xmlreader is nothing then
updatecache = true
response.Write("null")
end if
if not updatecache then
if not xmlReader.read() then
response.Write("no read")
updatecache = true
end if
end if
if updatecache then
response.write("no cached")
...
生成xmlReader
...
cache.insert("cache",xmlReader,nothing,datetime.now.AddHours(24),timespan.zero)
end if
xmlDoc.Load(xmlReader)