ASP.NET 缓存与SQL Server结合使用

通过运行命令行进入如下目录:
    C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
使用下面的命令为 Northwind 数据库中的 Employees 表启用缓存通知:
    aspnet_regsql.exe -S <Server> -U <Username> -P <Password> -ed -d Northwind -et -t Employees

运行之后,查看数据库,会发现生成如下信息:
数据表:AspNet_SqlCacheTablesForChangeNotification;
存储过程:
AspNet_SqlCachePollingStoredProcedure
AspNet_SqlCacheQueryRegisteredTablesStoredProcedure
AspNet_SqlCacheRegisterTableStoredProcedure
AspNet_SqlCacheUnRegisterTableStoredProcedure
AspNet_SqlCacheUpdateChangeIdStoredProcedure
Employees表对应的触发器:
Employees_AspNet_SqlCacheNotification_Trigger

在 Web.config 文件中设置缓存配置

<!-- caching section group -->
<caching>
    <sqlCacheDependency enabled = "true" pollTime = "1000" >
       <databases>
          <add name="Northwind" 
                 connectionStringName="NorthwindConnectionString1"
                 pollTime = "1000"/>
       </databases>
    </sqlCacheDependency>
</caching>
原文地址:https://www.cnblogs.com/yumianhu/p/3710767.html