Changeset 366 in svn for trunk/xcache.c


Ignore:
Timestamp:
2007-04-07T03:21:34Z (8 years ago)
Author:
Xuefer
Message:

fixed #80: avoid negetive GC count down

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache.c

    r360 r366  
    456456    xc_mem_t *mem = cache->mem;
    457457    const xc_mem_handlers_t *handlers = mem->handlers;
    458     zend_ulong interval = (cachetype == XC_TYPE_PHP) ? xc_php_gc_interval : xc_var_gc_interval;
     458    zend_ulong interval;
     459    if (cachetype == XC_TYPE_PHP) {
     460        interval = xc_php_ttl ? xc_php_gc_interval : 0;
     461    }
     462    else {
     463        interval = xc_var_gc_interval;
     464    }
    459465
    460466    add_assoc_long_ex(return_value, ZEND_STRS("slots"),     cache->hentry->size);
     
    468474    add_assoc_long_ex(return_value, ZEND_STRS("deleted"),   cache->deletes_count);
    469475    if (interval) {
    470         add_assoc_long_ex(return_value, ZEND_STRS("gc"),    (cache->last_gc_expires + interval) - XG(request_time));
     476        time_t gc = (cache->last_gc_expires + interval) - XG(request_time);
     477        add_assoc_long_ex(return_value, ZEND_STRS("gc"),    gc > 0 ? gc : 0);
    471478    }
    472479    else {
Note: See TracChangeset for help on using the changeset viewer.