[PATCH 1/2] Skip cache slot when time-to-live is zero

Jason A. Donenfeld Jason at zx2c4.com
Thu Feb 6 20:52:46 CET 2014


On Wed, Feb 5, 2014 at 10:46 AM, Lukas Fleischer <cgit at cryptocrack.de>wrote:
>
>         /* If the cache is disabled, just generate the content */
> -       if (size <= 0) {
> +       if (size <= 0 || ttl == 0) {
>                 fn();
>                 return 0;
>         }


Apparently we already special case ttl for < 0:

/* Check if the slot has expired */
static int is_expired(struct cache_slot *slot)
{
        if (slot->ttl < 0)
                return 0;
        else
                return slot->cache_st.st_mtime + slot->ttl * 60 <
time(NULL);
}

What should our behavior be for consistency?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140206/82d4383c/attachment.html>


More information about the CGit mailing list