Table of Contents | Previous | Next | Index

Netscape Directory SDK 3.0 for C Programmer’s Guide
     Chapter 18 Functions

ldap_memcache_init()

Creates an in-memory cache for your LDAP client that you can associate with an LDAP connection.

Syntax

#include <ldap.h>
int ldap_memcache_init( unsigned long ttl, unsigned long size,
   char **baseDNs, struct ldap_thread_fns *thread_fns,
   LDAPMemCache **cachep );

Parameters

This function has the following parameters:

ttl

The maximum amount of time (in seconds) that an item can be cached.

If 0, there is no limit to the amount of time that an item can be cached.

size

Maximum amount of memory (in bytes) that the cache will consume.

If 0, the cache has no size limit.

baseDNs

An array of the base DN strings representing the base DNs of the search requests you want cached.

thread_fns

An ldap_thread_fns structure specifying the functions that you want used to ensure that the cache is thread-safe.

You should specify this if you have multiple threads that are using the same connection handle and cache.

If you are not using multiple threads, pass NULL for this parameter.

cachep

When you call this function, the function sets this parameter to the pointer to the newly created LDAPMemCache structure.

Returns

One of the following values:

Description

The ldap_memcache_init() function creates an in-memory, client-side cache that you can use to cache search requests.

The function passes back a pointer to an LDAPMemCache structure, which represents the cache. You should call the ldap_memcache_set() function to associate this cache with an LDAP connection handle (an LDAP structure).

On Windows NT, if the ldap_memcache_init() function returns an LDAP_PARAM_ERROR result code, verify that your client is using the version of the nsldap32v30.dll file provided with the Netscape Directory SDK 3.0 for C. (Some of the Netscape servers, such as the Netscape Directory Server 3.0, install an older verison of the nsldap32v30.dll file in the Windows system32 directory.) For example, you may want to copy the nsldap32v30.dll file provided with the Netscape Directory SDK 3.0 for C to your client's directory.

The cache uses search criteria as the key to cached items. When you send a search request, the cache checks the search criteria to determine if that request has been cached previously. If the request was cached, the search results are read from the cache.

To flush the cache, call the ldap_memcache_flush() function.

When you are done with the cache, you can free it from memory by calling the ldap_memcache_destroy() function.

See Also

LDAPMemCache, ldap_memcache_set(), ldap_memcache_get(), ldap_memcache_update(), ldap_memcache_flush(), ldap_memcache_destroy().


Table of Contents | Previous | Next | Index

Last Updated: 10/01/98 17:06:23