Share via


ICacheManager::GetCache

Ee783942.c++_off(en-US,CS.10).gifEe783942.vb_on(en-US,CS.10).gif

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

Definition

HRESULT ICacheManager::GetCache(BSTRbstrName,IDispatch**ppdict);

Parameters

bstrName

[in] A BSTR that contains the name of the cache to be retrieved.

ppdict

[out,retval] A pointer used to return the IDispatch interface of the data cache Dictionary object.

Return Values

Error Values

This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT 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, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return 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.

See Also

CacheManager Object


All rights reserved.