From 2b29da0c2ea26907c964bef179337a2cc614a22c Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sun, 27 Jun 2010 21:12:28 +0200 Subject: Check the cache DB every 15 minutes instead of checking on every write. --- NEWS | 2 ++ src/gnutls_cache.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c0f3a0d..9750e7d 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ - Depend on gnutls 2.10.0 to force support for safe renegotiation. +- Optimizations in session caching. + ** Version 0.5.6 (2010-03-24) - Corrected issue with firefox and long POST data (by handling EINTR and EAGAIN errors in read). diff --git a/src/gnutls_cache.c b/src/gnutls_cache.c index 4d4a661..4d0a733 100644 --- a/src/gnutls_cache.c +++ b/src/gnutls_cache.c @@ -309,8 +309,14 @@ static int dbm_cache_expire(mgs_handle_t *ctxt) int keyidx = 0; int should_delete = 0; - apr_pool_create(&spool, ctxt->c->pool); ex = apr_time_now(); + + if (ex - ctxt->sc->last_cache_check < 900) + return 0; + + ctxt->sc->last_cache_check = ex; + + apr_pool_create(&spool, ctxt->c->pool); rv = apr_dbm_open(&dbm, ctxt->sc->cache_config, APR_DBM_READONLY, SSL_DBM_FILE_MODE, spool); -- cgit