]> git.sur5r.net Git - openldap/blob - doc/man/man5/slapo-pcache.5
ITS#3745 use "pcache" to instantiate instead of "proxycache"
[openldap] / doc / man / man5 / slapo-pcache.5
1 .TH SLAPO-PCACHE 5 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" Copyright 1998-2005 The OpenLDAP Foundation, All Rights Reserved.
3 .\" Copying restrictions apply.  See the COPYRIGHT file.
4 .\" Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
5 .\" $OpenLDAP$
6 .SH NAME
7 slapo-pcache \- proxycache overlay
8 .SH SYNOPSIS
9 ETCDIR/slapd.conf
10 .SH DESCRIPTION
11 The
12 .B pcache
13 overlay to
14 .BR slapd (8)
15 allows caching of LDAP search requests (queries) in a local database.
16 For an incoming query, the
17 proxy cache determines its corresponding \fBtemplate\fP. If the template
18 was specified as cacheable using the \fBproxytemplate\fP directive
19 and the request is contained in a cached request, it is answered from 
20 the proxy cache.
21 Otherwise, the search is performed as usual and cacheable search results 
22 are saved in the cache for use in future queries.
23 .LP
24
25 A template is defined by a filter string and an index identifying a set of
26 attributes. The \fBtemplate string\fP for a query can be obtained by
27 removing assertion values from the RFC 2254 representation of its search
28 filter. A query belongs to a template if its template string and set of
29 projected attributes correspond to a cacheable template.
30 Examples of template strings are \fB(mail=)\fP, \fB(|(sn=)(cn=))\fP,
31 \fB(&(sn=)(givenName=))\fP.
32
33 .LP 
34 The config directives that are specific to the
35 .B proxycache
36 overlay can be prefixed by
37 .BR proxycache\- ,
38 to avoid conflicts with directives specific to the underlying database
39 or to other stacked overlays.  This may be particularly useful for those
40 directives that refer to the backend used for local storage.
41 The following cache specific directives can be used to configure the proxy
42 cache: 
43 .TP
44 .B overlay pcache
45 This directive adds the proxy cache overlay to the current backend. The
46 proxy cache overlay may be used with any backend but is intended for use
47 with the
48 .BR ldap ,
49 .BR meta ,
50 and
51 .BR sql
52 backends.
53 .TP
54 .B proxycache <database> <max_entries> <numattrsets> <entry_limit> <cc_period> 
55 The directive enables proxy caching in the current backend and sets general
56 cache parameters. A <database> backend will be used internally to maintain
57 the cached entries. The chosen database will need to be configured as well,
58 as shown below. Cache replacement is invoked when the cache size grows to 
59 <max_entries> entries and continues till the cache size drops below this size.
60 <numattrsets> should be equal to the number of following \fBproxyattrset\fP
61 directives. Queries are cached only if they correspond to a cacheable template
62 (specified by the \fBproxytemplate\fP directive) and the number of entries
63 returned is less than <entry_limit>. Consistency check is performed every
64 <cc_period> duration (specified in secs). In each cycle queries with expired
65 "time to live(\fBTTL\fP)" are removed. A sample cache configuration is: 
66 .LP
67 .RS
68 proxycache \fBbdb 10000 1 50 100\fP
69 .RE
70 .TP
71 .B proxyattrset <index> <attrs...>
72 Used to associate a set of attributes <attrs..> with an <index>. Each attribute
73 set is associated with an integer from 0 to <numattrsets>-1. These indices are
74 used by the \fBproxytemplate\fP directive to define cacheable templates. 
75
76 .TP
77 .B proxytemplate <template_string> <attrset_index> <ttl> 
78 Specifies a cacheable template and "time to live" (in sec) <ttl> of queries 
79 belonging to the template. 
80
81 .TP
82 .B response-callback { head | tail }
83 Specifies whether the response callback should be placed at the
84 .B tail
85 (the default) or at the 
86 .B head
87 (actually, wherever the stacking sequence would make it appear) 
88 of the callback list.  This affects how the overlay interacts with other
89 overlays, since the proxycache overlay should be executed as early 
90 as possible (and thus configured as late as possible), to get 
91 a chance to return the cached results; however, if executed early
92 at response, it would cache entries that may be later "massaged"
93 by other databases and thus returned \fIafter\fP massaging the first
94 time, and \fIbefore\fP massaging when cached.
95
96 .LP
97 The following adds a template with filter string \fB((&sn=)(givenName=))\fP 
98 and attributes mail, postaladdress, telephonenumber and a TTL of 1 hour. 
99 .LP
100 .RS
101 .nf
102 proxyattrset \fB0 mail postaladdress telephonenumber\fP
103 proxytemplate \fB(&(sn=)(givenName=)) 0 3600\fP
104 .fi
105 .RE
106
107 .LP
108 Directives for configuring the underlying database must also be given, as
109 shown here:
110 .LP
111 .RS
112 .nf
113 directory /var/tmp/cache
114 cachesize 100
115 .fi
116 .RE
117 .LP
118 Any valid directives for the chosen database type may be used.
119 .SH FILES
120 .TP
121 ETCDIR/slapd.conf
122 default slapd configuration file
123 .SH SEE ALSO
124 .BR slapd.conf (5),
125 .BR slapd\-ldap (5),
126 .BR slapd\-meta (5),
127 .BR slapd\-sql (5),
128 .BR slapd (8).
129 .SH AUTHOR
130 Originally implemented by Apurva Kumar as an extension to back-meta;
131 turned into an overlay by Howard Chu.