I have ASP.net site (4.5) which uses sql cache notification. (using aspnet_regsql.exe
)
The idea is that SQL server tables are stored in the app's cache .This is for - not to load data over and over again from the specific table.
The beauty is that Asp.net's cache
can automatically remove the table from the cache
(and load it again - optionally) when data is modified on that table.
It is done via web.config :
<system.web>
<caching>
<sqlCacheDependency enabled="true">
<databases>
<add name="Northwind" connectionStringName="AppConnectionString1"
pollTime="500" />
</databases>
</sqlCacheDependency>
</caching>
</system.web>
But the way it works is by polling the main sql cache Notification table (which basically holds table names and counters)
Question:
I know that service broker can be used instead . But how does the mechanism is different as opposed to polling? I mean - when a table is changed - there is a trigger which updates the main table but how ASP.net knows that a counter (which represent a change) has been increased ? does ASP.net still polls ?