alt
Advertisement
Sponsored links
Online Training
Career Series
Exforsys
Exforsys arrow Tutorials arrow ASP.NET 2.0 arrow ASP.NET 2.0 Free Tutorials : State Management And Caching in ASp.net 2.0
Site Search


ASP.NET 2.0 Free Tutorials : State Management And Caching in ASp.net 2.0
Article Index
ASP.NET 2.0 Free Tutorials : State Management And Caching in ASp.net 2.0
Page 2

.

.

 

6. The number of new methods added to the CacheDependency Class make it extensible.

a. DependencyDispose is a protected method that releases the resources used by the class

b. GetUniqueID is a public method that retrieves a unique string identifier for the object

c. NotifyDependencyChanged is a protected method that informs the base class that the dependency .represented by an object has changed.

..................d. SetUtcLastModified is a protected method that marks the time when a dependency
..................changes.

..................e. HasChanged is a public Boolean read only property that indicates whether the
..................dependency has changed

..................f. UtcLastModified is a public read only property that gets the time from the
..................SetUtcLastModified.

7. The CacheDependency class has been designed to support only a limited set of well known dependencies. For instance the user cannot insert code to check whether a dependency condition has been meant.

..................a. The CacheDependency object internally sets up a file monitor object and receive a call
..................from it whenever the monitored object changes. This object is called a
..................FileSystemWatcher object .

..................b. It has an event handler and establishes a link between the CacheDependency object
..................and the Cache object and its items.

..................c. An event is fired whenever the monitored object changes.

8. In addition to creating a single dependency on an entry ASP.NET Cache also aggregates dependencies. For instance, a Cache entry can be made dependent both on a file and a SQL Server table.

..................a. Custom cache dependency objects inherit CacheDependency, so the array of
..................dependencies can be extremely wide.

..................b. The AggregateCacheDependency class is built as a custom cache dependency object
..................and inherits from the CacheDependency class.

9. The SqlCacheDependency class which inherits from CacheDependency class supports dependencies on SQL Server tables.

..................a. It implements features that are compatible with MSDE, SQL Server 7.0 and subsequent
..................versions.

..................b. The class works only when the tables on which dependencies have to be created are
..................enabled.

..................c. The SqlCacheDependency class has two constructors. The first takes the
..................SqlCommand object and the second accepts two strings—the database name and
..................the table name.

.............................i. The SqlCacheDependency class sets up a dependency relationship with SQL
................................Server 2005 known as command notification.

.............................ii. Whenever there are changes in the tables involved the notification is sent to the
.................................caller.

.............................iii. The caller then handles the event and lets the parent know through the
.................................. NotifyDependencyChanged.

..................d. Triggers and stored procedures will have to be created to handle any incoming
..................UPDATE, INSERT and DELETE statements.

..................e. This must be done before the application is published.

..................f. The command line tool aspnet_regsqlcache or the methods of
..................SqlCacheDependencyAdmin can be used to enable the database for notifications.

..................g. The database entry is to be bound to a connection string entry

..................h. The poll component then, accesses the newly created table to see whether other tables
..................have changed.

..................i. If one or more tables have to be monitored for changes they can be added to a list
..................programmatically by defining a trigger on the table that is sensitive to insert, updates and
..................deletions. The trigger can increment the value of the ChangeID column.

j. A key architectural component is the cache dependency manager object. This component accesses the table and reads the ChangeID field and informs the corresponding cache object if a change has occurred.

k. The cache dependency object is dependent on a helper cache key, whose name is defined in accordance with the table and the database. This helper cache entry is removed so that the original SqlCacheDependency object is invalidated.


Trackback(0)
Comments (0)add comment

Write comment

busy

 
< Prev   Next >
Exforsys Offers
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape