Name
CacheDependency
Synopsis
Cache dependencies allow the validity of a cache item to be based on a
file or directory on the web server, or on another cache item. When the
dependency object changes, the dependent cache item is invalidated and removed automatically. To set up a dependency, you first create a CacheDependency
object that
references the file, directory, or cache item upon which the dependency
will be based. You then use the Cache.Insert()
method to add the
dependent cache item, with the CacheDependency
object supplied
as a parameter.
The overloaded constructor of the CacheDependency
class determines
the type of dependency. You can pass a single string argument to set up
a dependency on a file or directory
(CacheDependency(Server.MapPath("data.xml")
) or you
can use a second string argument with the key of another cache item
(CacheDependency(Nothing
, "MyData")
). Other versions
of the constructor allow you to specify an array of strings specifying
files or cache objects. If any one file or object changes, the
dependent cache item will be invalidated.
The CacheDependency
object begins
to monitor for changes as soon as it is created to account
for changes that may occur in the brief delay before the dependent
cache item is added to the Cache
class.
Public NotInheritable Class CacheDependency : Implements IDisposable ' Public Constructors Public Sub New(ByVal filename As String) Public Sub New(ByVal filenames As String()) Public Sub New(ByVal filenames As String(), ByVal ...
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.