1. | Which caching methods are the easiest to implement? |
|
2. | Which method from the Cache class can be used to add an item to the cache regardless of whether a duplicate already exists? |
|
3. | What two SQL Server objects must be created in your database before you can create a query notification? |
|
4. | When using query notifications, what must be done to alert your application of changes to the data? |
|
Answers
1. | Page-level and user-control level caching are known as output caching; both methods can be easily implemented using an OutputCache directive at the top of your Web page or user control file. |
2. | Although the Add method will attempt to add an item if a duplicate exists, it will throw an exception. The Insert method will just replace the value for the cached item. |
3. | The Queues and Services objects, which are both visible from the Service Broker node in SQL Server Management Studio, must be created with Transact-SQL code before you can create a query notification. The service will be referenced in the code to establish the notification. |
4. | You must create code that instantiates a secondary thread, which is used to monitor the Service Broker queue for items. At this point, you will need to also have code that does an update of the cached item. |