From 88c6cfa81436f55cb0e884f61169fd8a7b25dc5b Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 16 Aug 2009 23:26:34 +0000 Subject: [PATCH] Deprecate previous config keywords. Add ttr parsing (no functionality yet) --- servers/slapd/overlays/pcache.c | 91 ++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 25 deletions(-) diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index 3190e95341..8b6d75aada 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -132,6 +132,7 @@ typedef struct query_template_s { time_t ttl; /* TTL for the queries of this template */ time_t negttl; /* TTL for negative results */ time_t limitttl; /* TTL for sizelimit exceeding results */ + time_t ttr; /* time to refresh */ struct attr_set t_attrs; /* filter attrs + attr_set */ } QueryTemplate; @@ -2725,50 +2726,76 @@ static ConfigLDAPadd pc_ldadd; static ConfigCfAdd pc_cfadd; static ConfigTable pccfg[] = { - { "proxycache", "backend> " + { "pcache", "backend> " " " + " " + " cr_msg, sizeof( c->cr_msg ), - " %d %ld %ld %ld", + " %d %ld %ld %ld %ld", temp->attr_set_index, temp->ttl, temp->negttl, - temp->limitttl ); + temp->limitttl, + temp->ttr ); bv.bv_len += temp->querystr.bv_len + 2; bv.bv_val = ch_malloc( bv.bv_len+1 ); ptr = bv.bv_val; @@ -3169,7 +3198,19 @@ pc_cf_gen( ConfigArgs *c ) temp->ttl = (time_t)t; temp->negttl = (time_t)0; temp->limitttl = (time_t)0; + temp->ttr = (time_t)0; switch ( c->argc ) { + case 7: + if ( lutil_parse_time( c->argv[6], &t ) != 0 ) { + snprintf( c->cr_msg, sizeof( c->cr_msg ), + "unable to parse template ttr=\"%s\"", + c->argv[6] ); + Debug( LDAP_DEBUG_CONFIG, "%s: %s.\n", c->log, c->cr_msg, 0 ); + return( 1 ); + } + temp->ttr = (time_t)t; + /* fallthru */ + case 6: if ( lutil_parse_time( c->argv[5], &t ) != 0 ) { snprintf( c->cr_msg, sizeof( c->cr_msg ), -- 2.39.5