Platform SDK: Active Directory, ADSI, and Directory Services

Caching the Result (Client Side)

Client-side caching stores the result set in the client's memory, providing performance enhancements on the client side. Clients can revisit an object again and again without making separate trips to the server. By default, ADSI caches the result set on behalf of clients. This allows ADSI to provide clients with SQL-like cursor support. You may iterate through a given result set several times. For example, you can safely use IDirectorySearch::GetNextRow and IDirectorySearch::GetPreviousRow. (There will be more discussion on these methods later.)

ADSI also allows clients to turn off the cache to reduce memory requirements. If client-side caching is disabled, the client will not maintain the result set in memory. Each row will be freed after the application retrieves it. Disabling client-side caching can be useful for decreasing the client-side memory requirements in such cases as when you only intend to make a single pass through the result set. However, when clients elect not to cache the result, they give up cursor support.