apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Spiegle <m...@nauticaltech.com>
Subject apr_reslist TTL values are in usecs
Date Thu, 16 Jul 2009 02:09:25 GMT

I was writing a module which takes advantage of apr_memcache to cache file
objects.  Apr_memcache uses apr_reslist (which I'd like to say is really
awesome), but the documentation/api is slightly flawed in my opinion:

The documentation for apr_memcache_server_create() states that the TTL is
specified in seconds

The documentation for apr_reslist_create() doesn't make a distinction of
the time unit.  It just says "time"

In reality, apr_reslist_acquire() uses apr_time_now() to compute TTL
values.  The issue here is that apr_time_now() reports microseconds since
APR_DECLARE(apr_time_t) apr_time_now(void)
    struct timeval tv;
    gettimeofday(&tv, NULL);
    return tv.tv_sec * APR_USEC_PER_SEC + tv.tv_usec;

I banged my head on the desk for a bit on that one.  IMO, the TTL value
should be in seconds which seems more natural to me, but accurate
documentation would have worked too.

In any case, thanks for all the hard work on the APR libs.  I'm new to
apache development, but am definitely enjoying the entire apache framework.

Michael Spiegle

View raw message