]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_cache.3
db7e9f22e2603be3034cbf299781c9d074aff02b
[openldap] / doc / man / man3 / ldap_cache.3
1 .TH LDAP_CACHE 3 "22 September 1998" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
5 .SH NAME
6 ldap_enable_cache, ldap_disable_cache, ldap_destroy_cache, ldap_flush_cache, ldap_uncache_entry, ldap_uncache_request, ldap_set_cache_options \- LDAP client caching routines
7 .SH SYNOPSIS
8 .nf
9 .ft B
10 #include <ldap.h>
11 .ft
12 .LP
13 .ft B
14 ldap_enable_cache( ld, timeout, maxmem )
15 .ft
16 LDAP    *ld;
17 long    timeout;
18 long    maxmem;
19 .LP
20 .ft B
21 void ldap_disable_cache( ld )
22 .ft
23 LDAP    *ld;
24 .LP
25 .ft B
26 void ldap_destroy_cache( ld )
27 .ft
28 LDAP    *ld;
29 .LP
30 .ft B
31 void ldap_flush_cache( ld )
32 .ft
33 LDAP    *ld;
34 .LP
35 .ft B
36 void ldap_uncache_entry( ld, dn )
37 .ft
38 LDAP    *ld;
39 char    *dn;
40 .LP
41 .ft B
42 void ldap_uncache_request( ld, msgid )
43 .ft
44 LDAP    *ld;
45 int     msgid;
46 .LP
47 .ft B
48 void ldap_set_cache_options( ld, opts )
49 .ft
50 LDAP            *ld;
51 unsigned long   opts;
52 .fi
53 .SH DESCRIPTION
54 .LP
55 These routines are used to control the behavior of client caching of
56 .BR ldap_search (3),
57 .BR cldap_search_s (3),
58 and
59 .BR ldap_compare (3)
60 operations.  By
61 default, the cache is disabled and no caching is done.  Enabling the
62 cache can greatly improve performance and reduce network bandwidth when
63 a client DUA makes repeated requests.
64 .LP
65 .B ldap_enable_cache()
66 should be called to turn on local caching or to
67 change cache parameters (lifetime of cached requests and memory used).
68 The \fIld\fP parameter should be the result of a successful call to
69 .BR ldap_open (3).
70 The \fItimeout\fP is specified in seconds, and is used to
71 decide how long to keep cached requests.  The \fImaxmem\fP value is in
72 bytes, and is used to set an upper bound on how memory the cache will
73 use.  You can specify 0 for \fImaxmem\fP to restrict the cache size by
74 the \fItimeout\fP only.  The first call to ldap_enable_cache creates
75 the cache; subsequent calls re-enable the cache and set the timeout and
76 memory values.
77 .LP
78 .B ldap_disable_cache()
79 temporarily disables use of the cache (new
80 requests are not cached and the cache is not checked when returning
81 results).  It does not delete the cache contents.
82 .LP
83 .B ldap_destroy_cache()
84 turns off caching and completely removes the cache from memory.
85 .LP
86 .B ldap_flush_cache()
87 deletes the cache contents, but does not effect it in any other way.
88 .LP
89 .B ldap_uncache_entry()
90 removes all requests that make reference to the
91 distinguished name \fIdn\fP from the cache.  It should be used, for
92 example, after doing an
93 .BR ldap_modify (3)
94 call involving \fIdn\fP.
95 .LP
96 .B ldap_uncache_request()
97 removes the request indicated by the LDAP request
98 id \fImsgid\fP from the cache.
99 .LP
100 .B ldap_set_cache_options()
101 is used to change caching behavior.  The current supported options are
102 .B LDAP_CACHE_OPT_CACHENOERRS
103 to suppress caching of any requests that result in an error, and
104 .B LDAP_CACHE_OPT_CACHEALLERRS
105 to enable caching of all requests.  The default behavior is to not
106 cache requests that result in errors, except that request that result
107 in the error
108 .B LDAP_SIZELIMIT_EXCEEDED
109 are cached.
110 .SH ERRORS
111 .B ldap_enable_cache()
112 returns 0 upon success, and -1 if it is unable to
113 allocate space for the cache.  All the other calls are declared as
114 void and return nothing.
115 .SH SEE ALSO
116 .BR ldap (3),
117 .BR ldap_search (3),
118 .BR ldap_compare (3),
119 .BR cldap_search_s (3)
120 .SH ACKNOWLEDGEMENTS
121 .B      OpenLDAP
122 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
123 .B      OpenLDAP
124 is derived from University of Michigan LDAP 3.3 Release.