整页缓存:适合不需要实时显示的数据的页面
方法:在页头加上<% OutputCache Duration="60" VaryByParam="none"%>
解释:Duration设置缓存时间单位为秒。VaryByParam = none设置为无参数缓存
部分缓存:适合对页面局部数据进行缓存
方法:新建用户控件,在用户控件页头加入<% OutputCache Duration="60" VaryByParam="none"%>
缓存API:使用Cache对象
方法:Cache["key"] = Value;
其他:DiskCacheable="true|false"设置是否将缓存放在硬盘中,true为是,false为放在内存中