using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Caching;

public partial class CacheDepend : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string caminho = @"C:\Livro\Capitulo21\Estado.xml";
        DataView dv;
        if (Cache["CacheItem1"] == null)
        {
            DataSet ds = new DataSet();
            ds.ReadXml(caminho);
            Cache.Insert("CacheItem1", new DataView(ds.Tables[0]), new CacheDependency(caminho),
            DateTime.Now.AddMinutes(5), TimeSpan.Zero);
            dv = (DataView)Cache["CacheItem1"];
        }
        else
        {
            dv = (DataView)Cache["CacheItem1"];
        }
        foreach (DataRowView dt in dv)
        {
            Response.Write(dt[0].ToString() + "<br/>");
            Response.Write(dt[1].ToString() + "<br/>");
        }
    }

}