table of contents
other versions
- wheezy 2.4.31-2+deb7u2
- wheezy-backports 2.4.31+really2.4.40+dfsg-1+deb8u1~bpo70+1
- jessie 2.4.40+dfsg-1+deb8u2
- jessie-backports 2.4.44+dfsg-4~bpo8+1
- testing 2.4.44+dfsg-5
- unstable 2.4.44+dfsg-5
SLAPO-PCACHE(5) | File Formats Manual | SLAPO-PCACHE(5) |
NAME¶
slapo-pcache - proxy cache overlay to slapdSYNOPSIS¶
/etc/ldap/slapd.confDESCRIPTION¶
The pcache overlay to slapd(8) allows caching of LDAP search requests (queries) in a local database. For an incoming query, the proxy cache determines its corresponding template. If the template was specified as cacheable using the pcacheTemplate directive and the request is contained in a cached request, it is answered from the proxy cache. Otherwise, the search is performed as usual and cacheable search results are saved in the cache for use in future queries.- overlay pcache
- This directive adds the proxy cache overlay to the current backend. The proxy cache overlay may be used with any backend but is intended for use with the ldap, meta, and sql backends. Please note that the underlying backend must have a configured rootdn.
- pcache <database> <max_entries> <numattrsets> <entry_limit> <cc_period>
- The directive enables proxy caching in the current backend and sets general cache parameters. A <database> backend will be used internally to maintain the cached entries. The chosen database will need to be configured as well, as shown below. Cache replacement is invoked when the cache size grows to <max_entries> entries and continues till the cache size drops below this size. <numattrsets> should be equal to the number of following pcacheAttrset directives. Queries are cached only if they correspond to a cacheable template (specified by the pcacheTemplate directive) and the number of entries returned is less than <entry_limit>. Consistency check is performed every <cc_period> duration (specified in secs). In each cycle queries with expired "time to live( TTL)" are removed. A sample cache configuration is:
pcache bdb 10000 1 50 100
- pcacheAttrset <index> <attrs...>
- Used to associate a set of attributes <attrs..> with
an <index>. Each attribute set is associated with an integer from 0
to <numattrsets>-1. These indices are used by the
pcacheTemplate directive to define cacheable templates. A set of
attributes cannot be empty. A set of attributes can contain the special
attributes "*" (all user attributes), "+" (all
operational attributes) or both; in the latter case, any other attribute
is redundant and should be avoided for clarity. A set of attributes can
contain "1.1" as the only attribute; in this case, only the
presence of the entries is cached. Attributes prefixed by
"undef:" need not be present in the schema.
- pcacheMaxQueries <queries>
- Specify the maximum number of queries to cache. The default
is 10000.
- pcacheValidate { TRUE | FALSE }
- Check whether the results of a query being cached can
actually be returned from the cache by the proxy DSA. When enabled, the
entries being returned while caching the results of a query are checked to
ensure consistency with the schema known to the proxy DSA. In case of
failure, the query is not cached. By default, the check is off.
- pcacheOffline { TRUE | FALSE }
- Set the cache to offline mode. While offline, the
consistency checker will be stopped and no expirations will occur. This
allows the cache contents to be used indefinitely while the proxy is cut
off from network access to the remote DSA. The default is FALSE, i.e.
consistency checks and expirations will be performed.
- pcachePersist { TRUE | FALSE }
- Specify whether the cached queries should be saved across
restarts of the caching proxy, to provide hot startup of the cache. Only
non-expired queries are reloaded. The default is FALSE.
- pcacheTemplate <template_string> <attrset_index> <ttl> [<negttl> [<limitttl> [<ttr>]]]
- Specifies a cacheable template and "time to live"
<ttl> of queries belonging to the template. An optional
<negttl> can be used to specify that negative results (i.e., queries
that returned zero entries) should also be cached for the specified amount
of time. Negative results are not cached by default (<negttl> set to
0). An optional <limitttl> can be used to specify that results
hitting a sizelimit should also be cached for the specified amount of
time. Results hitting a sizelimit are not cached by default
(<limitttl> set to 0). An optional <ttr> "time to
refresh" can be used to specify that cached entries should be
automatically refreshed after a certain time. Entries will only be
refreshed while they have not expired, so the <ttl> should be larger
than the <ttr> for this option to be useful. Entries are not
refreshed by default (<ttr> set to 0).
- pcacheBind <filter_template> <attrset_index> <ttr> <scope> <base>
- Specifies a template for caching Simple Bind credentials
based on an already defined pcacheTemplate. The
<filter_template> is similar to a <template_string> except
that it may have some values present. Its purpose is to allow the overlay
to generate filters similar to what other applications do when they do a
Search immediately before a Bind. E.g., if a client like nss_ldap is
configured to search for a user with the filter
"(&(objectClass=posixAccount)(uid=<username>))" then
the corresponding template
"(&(objectClass=posixAccount)(uid=))" should be used here.
When converted to a regular template e.g.
"(&(objectClass=)(uid=))" this template and the
<attrset_index> must match an already defined pcacheTemplate
clause. The "time to refresh" <ttr> determines the time
interval after which the cached credentials may be refreshed. The first
Bind request that occurs after that time will trigger the refresh attempt.
Refreshes are not performed when the overlay is Offline. There is no
"time to live" parameter for the Bind credentials; the
credentials will expire according to the pcacheTemplate ttl. The
<scope> and <base> should match the search scope and base used
by the authentication clients. The cached credentials are not stored in
cleartext, they are hashed using the default password hash. By default
Bind caching is not enabled.
- pcachePosition { head | tail }
- Specifies whether the response callback should be placed at
the tail (the default) or at the head (actually, wherever
the stacking sequence would make it appear) of the callback list. This
affects how the overlay interacts with other overlays, since the
proxycache overlay should be executed as early as possible (and thus
configured as late as possible), to get a chance to return the cached
results; however, if executed early at response, it would cache entries
that may be later "massaged" by other databases and thus
returned after massaging the first time, and before
massaging when cached.
- There are some constraints:
-
pcacheAttrset 0 mail postaladdress telephonenumber pcacheTemplate (&(sn=)(givenName=)) 0 3600
directory /var/tmp/cache cachesize 100
BACKWARD COMPATIBILITY¶
The configuration keywords have been renamed and the older form is deprecated. These older keywords are still recognized but may disappear in future releases.- proxycache
- use pcache
- proxyattrset
- use pcacheAttrset
- proxycachequeries
- use pcacheMaxQueries
- proxycheckcacheability
- use pcacheValidate
- proxysavequeries
- use pcachePersist
- proxytemplate
- use pcacheTemplate
- response-callback
- use pcachePosition
CAVEATS¶
Caching data is prone to inconsistencies because updates on the remote server will not be reflected in the response of the cache at least (and at most) for the duration of the pcacheTemplate TTL. These inconsistencies can be minimized by careful use of the TTR.FILES¶
- /etc/ldap/slapd.conf
- default slapd configuration file
SEE ALSO¶
slapd.conf(5), slapd-config(5), slapd-ldap(5), slapd-meta(5), slapd-sql(5), slapd(8).AUTHOR¶
Originally implemented by Apurva Kumar as an extension to back-meta; turned into an overlay by Howard Chu.2012/04/23 | OpenLDAP |