CacheManager.GetCache

Ee783941.c++_on(en-US,CS.10).gifEe783941.vb_off(en-US,CS.10).gif

Use this method to retrieve either the Dictionary or LRUCache object for the specified cache name.

Definition

Function GetCache(bstrName As String) As IDispatch

Parameters

bstrName

A String that contains the name of the cache to be retrieved.

Return Values

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

This method is designed to be lightweight and fast. It is commonly called several times on any given ASP page.

The first time the GetCache method or the RefreshCache method is called, the data cache object is created and the configured CacheLoader component is invoked to populate it with data. Subsequent calls to the GetCache method may return the same cache object or a new cache object that is created when the cache is refreshed.

If the first call to the GetCache method for a particular cache results in a failed refresh, then the CacheManager object will not immediately retry a refresh when more GetCache method calls are made for the same cache. This is to avoid recurring timeouts that might bring down a system, for example if a database connection becomes temporarily unavailable. In this failure scenario, subsequent calls to the GetCache method will return an error indicating that the cache load failed and will not be retried until the refresh interval has elapsed or until the RefreshCache method is explicitly called.

After a cache has successfully been created, if a subsequent refresh of the cache fails, then the existing cache object is returned until a later refresh succeeds. The CacheManager object provides high availability to cache data at the expense of ensuring the cached data is up to date.

Example

'oMyCache is an object
'strMyCacheName is a String containing the name of an existing cache.

Set oMyCache = myCacheManager.GetCache(strMyCacheName)

See Also

CacheManager Object


All rights reserved.