1ldap_memcache(3LDAP)        LDAP Library Functions        ldap_memcache(3LDAP)
2
3
4

NAME

6       ldap_memcache,    ldap_memcache_init,    ldap_memcache_set,   ldap_mem‐
7       cache_get,   ldap_memcache_flush,   ldap_memcache_destroy,    ldap_mem‐
8       cache_update - LDAP client caching functions
9

SYNOPSIS

11       cc -flag ... file...-lldap [ -library ... ]
12       #include <ldap.h>
13
14       int ldap_memcache_init(unsigned long ttl, unsigned long size,
15            char **baseDNs,struct ldap_thread_fns *thread_fns,
16            LDAPMemCache **cachep
17
18
19       int ldap_memcache_set(LDAP *ld, LDAPMemCache **cache
20
21
22       int ldap_memcache_get(LDAP *ld, LDAPMemCache **cachep
23
24
25       void ldap_memcache_flush(LDAPMemCache *cache, char *dn, int scope
26
27
28       void ldap_memcache_destroy(LDAPMemCache *cache
29
30
31       void ldap_memcache_update(LDAPMemCache *cache
32
33

DESCRIPTION

35       Use  the  ldap_memcache  functions to maintain an in-memory client side
36       cache to  store  search  requests.  Caching  improves  performance  and
37       reduces  network  bandwidth  when a client makes repeated requests. The
38       cache uses search criteria as the key to the  cached  items.  When  you
39       send  a  search request, the cache checks the search criteria to deter‐
40       mine if that request has been previously stored . If  the  request  was
41       stored, the search results are read from the cache.
42
43
44       Make a call to ldap_memcache_init() to create the in-memory client side
45       cache. The function passes back a pointer to an LDAPMemCache structure,
46       which  represents  the  cache.  Make  a call to the ldap_memcache_set()
47       function to associate this cache with an  LDAP  connection  handle,  an
48       LDAP  structure.  ttl  is  the the maximum  amount of time (in seconds)
49       that an item can be cached. If a ttl value  of 0 is passed, there is no
50       limit  to  the  amount of time that an item  can be cached. size is the
51       maximum amount of memory (in bytes) that the cache will consume. A zero
52       value  of  size means the cache has  no size limit. baseDNS is an array
53       of the base DN  strings  representing   the  base  DNs  of  the  search
54       requests  you  want  cached.  If  baseDNS  is not NULL, only the search
55       requests with the specified base DNs will  be  cached.  If  baseDNS  is
56       NULL,   all  search requests are cached. The thread_fns parameter takes
57       an ldap_thread_fns structure specifying the  functions  that  you  want
58       used  to  ensure that the cache is thread-safe. You should specify this
59       if you have multiple threads that are using the same connection  handle
60       and  cache.  If  you are not using multiple threads, pass NULL for this
61       parameter.
62
63
64       ldap_memcache_set() associates an in-memory cache that you have already
65       created  by calling the ldap_memcache_init() function with an LDAP con‐
66       nection handle. The ld parameter should be the result of  a  successful
67       call  to ldap_open(3LDAP). The cache parameter should be the result  of
68       a cache created by the ldap_memcache_init() call. After you  call  this
69       function,  search requests made over the specified LDAP connection will
70       use this cache. To disassociate the cache from the LDAP connection han‐
71       dle,  make a call to the ldap_bind(3LDAP) or ldap_bind(3LDAP) function.
72       Make a call to ldap_memcache_set() if you want to  associate   a  cache
73       with multiple LDAP connection handles. For example, call  the ldap_mem‐
74       cache_get() function to get the cache associated with  one  connection,
75       then  you  can  call this function and associate the cache with another
76       connection.
77
78
79       The ldap_memcache_get() function gets the  cache  associated  with  the
80       specified connection handle (LDAP structure). This cache is used by all
81       search  requests made through that connection. When you call this func‐
82       tion,  the function sets the cachep parameter as a pointer to the LDAP‐
83       MemCache structure that is associated with the connection handle.
84
85
86       ldap_memcache_flush() flushes search requests from the  cache.  If  the
87       base DN of a search request is within the scope specified by the dn and
88       scope arguments, the search request is flushed from the cache. If no DN
89       is  specified,  the entire cache is flushed. The scope parameter, along
90       with the dn parameter, identifies the search  requests  that  you  want
91       flushed  from  the  cache.  This argument can have one of the following
92       values:
93         LDAP_SCOPE_BASE
94         LDAP_SCOPE_ONELEVEL
95         LDAP_SCOPE_SUBTREE
96
97
98       ldap_memcache_destroy()  frees  the  specified  LDAPMemCache  structure
99       pointed  to by cache from memory. Call this function after you are done
100       working with a cache.
101
102
103       ldap_memcache_update() checks the cache for  items  that  have  expired
104       and  removes  them. This check is typically done as part of the way the
105       cache normally works. You do not need to call this function unless  you
106       want  to  update the cache at this point in time. This function is only
107       useful in a multithreaded application, since it will not  return  until
108       the cache is destroyed.
109

PARAMETERS

111       ttl           The  maximum amount of time (in seconds) that an item can
112                     be cached
113
114
115       size          The maximum amount of memory (in bytes)  that  the  cache
116                     will consume.
117
118
119       baseDNs       An  array  of  the base DN strings representing  the base
120                     DNs of the search requests you want cached
121
122
123       thread_fns    A pointer to the ldap_thread_fns structure structure.
124
125
126       cachep        A pointer to the LDAPMemCache structure
127
128
129       cache         The result of a cache created by the ldap_memcache_init()
130                     call
131
132
133       ld            The result of a successful call to ldap_open(3LDAP)
134
135
136       dn            The search requests that you want flushed from the cache
137
138
139       scope         The search requests that you want flushed from the cache
140
141

ERRORS

143       The  functions  that  have int return values return LDAP_SUCCESS if the
144       operation was successful. Otherwise, they  return  another  LDAP  error
145       code. See ldap_error(3LDAP) for a list of the LDAP error codes.
146

ATTRIBUTES

148       See attributes(5) for descriptions of the following attributes:
149
150
151
152
153       ┌─────────────────────────────┬─────────────────────────────┐
154       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
155       ├─────────────────────────────┼─────────────────────────────┤
156       │Availability                 │SUNWcsl (32-bit)             │
157       ├─────────────────────────────┼─────────────────────────────┤
158       │                             │SUNWcslx (64-bit)            │
159       ├─────────────────────────────┼─────────────────────────────┤
160       │Interface Stability          │Evolving                     │
161       └─────────────────────────────┴─────────────────────────────┘
162

SEE ALSO

164       ldap_error(3LDAP), ldap_open(3LDAP), ldap_search(3LDAP), attributes(5)
165
166
167
168SunOS 5.11                        6 Jan 2003              ldap_memcache(3LDAP)
Impressum