SLAPO-PCACHE(5)

NAME
slapo-pcache - proxycache overlay

SYNOPSIS
ETCDIR/slapd.conf

DESCRIPTION
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 proxytemplate 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.

A template is defined by a filter string and an index identifying a set of attributes. The template string for a query can be obtained by removing assertion values from the RFC 2254 representation of its search filter. A query belongs to a template if its template string and set of projected attributes correspond to a cacheable template. Examples of template strings are (mail=), (|(sn=)(cn=)), (&(sn=)(givenName=)).

The config directives that are specific to the proxycache overlay can be prefixed by proxycache-, to avoid conflicts with directives specific to the underlying database or to other stacked overlays. This may be particularly useful for those directives that refer to the backend used for local storage. The following cache specific directives can be used to configure the proxy cache:

overlay proxycache
    This directive adds the proxycache overlay to the current backend. The proxycache overlay may be used with any backend but is intended for use with the ldap, meta, and sql backends.

proxycache <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 proxyattrset directives. Queries are cached only if they correspond to a cacheable template (specified by the proxytemplate 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:

    proxycache bdb 10000 1 50 100

proxyattrset <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 proxytemplate directive to define cacheable templates.

proxytemplate <template_string> <attrset_index> <ttl>
    Specifies a cacheable template and "time to live" (in sec) <ttl> of queries belonging to the template.

The following adds a template with filter string ((&sn=)(givenName=)) and attributes mail, postaladdress, telephonenumber and a TTL of 1 hour.

    proxyattrset 0 mail postaladdress telephonenumber
    proxytemplate (&(sn=)(givenName=)) 0 3600

Directives for configuring the underlying database must also be given, as shown here:

    directory /var/tmp/cache
    cachesize 100

Any valid directives for the chosen database type may be used.

FILES

ETCDIR/slapd.conf
    default slapd configuration file

SEE ALSO
slapd.conf(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.