when the cache becomes full. Disabled by default.
DNS_CACHE_MAX_TTL dns_cache_max_ttl
DNS_CACHE_MEM dns_cache_mem
DNS_CACHE_GC_INT dns_cache_gc_interval
+DNS_CACHE_DEL_NONEXP dns_cache_del_nonexp|dns_cache_delete_nonexpired
/* blacklist */
USE_DST_BLST use_dst_blacklist
DST_BLST_MEM dst_blacklist_mem
return DNS_CACHE_MEM; }
<INITIAL>{DNS_CACHE_GC_INT} { count(); yylval.strval=yytext;
return DNS_CACHE_GC_INT; }
+<INITIAL>{DNS_CACHE_DEL_NONEXP} { count(); yylval.strval=yytext;
+ return DNS_CACHE_DEL_NONEXP; }
<INITIAL>{USE_DST_BLST} { count(); yylval.strval=yytext;
return USE_DST_BLST; }
<INITIAL>{DST_BLST_MEM} { count(); yylval.strval=yytext;
%token DNS_CACHE_MAX_TTL
%token DNS_CACHE_MEM
%token DNS_CACHE_GC_INT
+%token DNS_CACHE_DEL_NONEXP
/*blacklist*/
%token USE_DST_BLST
%token DST_BLST_MEM
| DNS_CACHE_MEM error { yyerror("boolean value expected"); }
| DNS_CACHE_GC_INT EQUAL NUMBER { IF_DNS_CACHE(dns_timer_interval=$3); }
| DNS_CACHE_GC_INT error { yyerror("boolean value expected"); }
+ | DNS_CACHE_DEL_NONEXP EQUAL NUMBER { IF_DNS_CACHE(dns_cache_del_nonexp=$3); }
+ | DNS_CACHE_DEL_NONEXP error { yyerror("boolean value expected"); }
| USE_DST_BLST EQUAL NUMBER { IF_DST_BLACKLIST(use_dst_blacklist=$3); }
| USE_DST_BLST error { yyerror("boolean value expected"); }
| DST_BLST_MEM EQUAL NUMBER { IF_DST_BLACKLIST(blst_max_mem=$3); }
* 2008-07-25 various rpc commands to manipulate the content
* of the cache (Miklos)
* 2007-07-30 DNS cache measurements added (Gergo)
+ * 2007-08-17 dns_cache_del_nonexp config option is introduced (Miklos)
*/
#ifdef USE_DNS_CACHE
int dns_flags=0; /* default flags used for the dns_*resolvehost
(compatibility wrappers) */
int dns_srv_lb=0; /* off by default */
+int dns_cache_del_nonexp=0; /* delete only expired entries by default */
#ifdef USE_DNS_CACHE_STATS
struct t_dns_cache_stats* dns_cache_stats=0;
#endif
LOG(L_WARN, "WARNING: dns_cache_add: cache full, trying to free...\n");
/* free ~ 12% of the cache */
- dns_cache_free_mem(*dns_cache_mem_used/16*14, 1);
+ dns_cache_free_mem(*dns_cache_mem_used/16*14, !dns_cache_del_nonexp);
if ((*dns_cache_mem_used+e->total_size)>=dns_cache_max_mem){
LOG(L_ERR, "ERROR: dns_cache_add: max. cache mem size exceeded\n");
return -1;
LOG(L_WARN, "WARNING: dns_cache_add: cache full, trying to free...\n");
/* free ~ 12% of the cache */
UNLOCK_DNS_HASH();
- dns_cache_free_mem(*dns_cache_mem_used/16*14, 1);
+ dns_cache_free_mem(*dns_cache_mem_used/16*14, !dns_cache_del_nonexp);
LOCK_DNS_HASH();
if ((*dns_cache_mem_used+e->total_size)>=dns_cache_max_mem){
LOG(L_ERR, "ERROR: dns_cache_add: max. cache mem size exceeded\n");
dns_cache_gc_interval = how often (in s) the dns cache will be garbage
collected.
Default: 120 s.
+
+ dns_cache_del_nonexp = yes | no or
+ dns_cache_delete_nonexpired = yes | no - allow deletion of non-expired
+ records from the cache when there is no more space left for new
+ ones. The last-recently used entries are deleted first.
+ Default: no
DNS Cache Compile Options
extern int dns_flags; /* default flags used for the dns_*resolvehost
(compatibility wrappers) */
extern int dns_srv_lb; /* default SRV LB support value */
+extern int dns_cache_del_nonexp; /* delete non-expired values from the cache when it is full */
#ifdef USE_DNS_CACHE_STATS
struct t_dns_cache_stats{