]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_cache.3
c0b356c34342aed4b6f9afedd40deda434b8b0d3
[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 and
58 .BR ldap_compare (3)
59 operations.  By
60 default, the cache is disabled and no caching is done.  Enabling the
61 cache can greatly improve performance and reduce network bandwidth when
62 a client DUA makes repeated requests.
63 .LP
64 .B ldap_enable_cache()
65 should be called to turn on local caching or to
66 change cache parameters (lifetime of cached requests and memory used).
67 The \fIld\fP parameter should be the result of a successful call to
68 .BR ldap_open (3).
69 The \fItimeout\fP is specified in seconds, and is used to
70 decide how long to keep cached requests.  The \fImaxmem\fP value is in
71 bytes, and is used to set an upper bound on how memory the cache will
72 use.  You can specify 0 for \fImaxmem\fP to restrict the cache size by
73 the \fItimeout\fP only.  The first call to ldap_enable_cache creates
74 the cache; subsequent calls re-enable the cache and set the timeout and
75 memory values.
76 .LP
77 .B ldap_disable_cache()
78 temporarily disables use of the cache (new
79 requests are not cached and the cache is not checked when returning
80 results).  It does not delete the cache contents.
81 .LP
82 .B ldap_destroy_cache()
83 turns off caching and completely removes the cache from memory.
84 .LP
85 .B ldap_flush_cache()
86 deletes the cache contents, but does not effect it in any other way.
87 .LP
88 .B ldap_uncache_entry()
89 removes all requests that make reference to the
90 distinguished name \fIdn\fP from the cache.  It should be used, for
91 example, after doing an
92 .BR ldap_modify (3)
93 call involving \fIdn\fP.
94 .LP
95 .B ldap_uncache_request()
96 removes the request indicated by the LDAP request
97 id \fImsgid\fP from the cache.
98 .LP
99 .B ldap_set_cache_options()
100 is used to change caching behavior.  The current supported options are
101 .B LDAP_CACHE_OPT_CACHENOERRS
102 to suppress caching of any requests that result in an error, and
103 .B LDAP_CACHE_OPT_CACHEALLERRS
104 to enable caching of all requests.  The default behavior is to not
105 cache requests that result in errors, except that request that result
106 in the error
107 .B LDAP_SIZELIMIT_EXCEEDED
108 are cached.
109 .SH ERRORS
110 .B ldap_enable_cache()
111 returns 0 upon success, and -1 if it is unable to
112 allocate space for the cache.  All the other calls are declared as
113 void and return nothing.
114 .SH SEE ALSO
115 .BR ldap (3),
116 .BR ldap_search (3),
117 .BR ldap_compare (3)
118 .SH ACKNOWLEDGEMENTS
119 .B      OpenLDAP
120 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
121 .B      OpenLDAP
122 is derived from University of Michigan LDAP 3.3 Release.