Browse Source

fixed #80: avoid negetive GC count down

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@366 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 15 years ago
parent
commit
5f738c36cf
  1. 11
      xcache.c

11
xcache.c

@ -455,7 +455,13 @@ static void xc_fillinfo_dmz(int cachetype, xc_cache_t *cache, zval *return_value
#endif
xc_mem_t *mem = cache->mem;
const xc_mem_handlers_t *handlers = mem->handlers;
zend_ulong interval = (cachetype == XC_TYPE_PHP) ? xc_php_gc_interval : xc_var_gc_interval;
zend_ulong interval;
if (cachetype == XC_TYPE_PHP) {
interval = xc_php_ttl ? xc_php_gc_interval : 0;
}
else {
interval = xc_var_gc_interval;
}
add_assoc_long_ex(return_value, ZEND_STRS("slots"), cache->hentry->size);
add_assoc_long_ex(return_value, ZEND_STRS("compiling"), cache->compiling);
@ -467,7 +473,8 @@ static void xc_fillinfo_dmz(int cachetype, xc_cache_t *cache, zval *return_value
add_assoc_long_ex(return_value, ZEND_STRS("cached"), cache->entries_count);
add_assoc_long_ex(return_value, ZEND_STRS("deleted"), cache->deletes_count);
if (interval) {
add_assoc_long_ex(return_value, ZEND_STRS("gc"), (cache->last_gc_expires + interval) - XG(request_time));
time_t gc = (cache->last_gc_expires + interval) - XG(request_time);
add_assoc_long_ex(return_value, ZEND_STRS("gc"), gc > 0 ? gc : 0);
}
else {
add_assoc_null_ex(return_value, ZEND_STRS("gc"));

Loading…
Cancel
Save