1
0
Fork 0

merged [374] [375] from trunk->1.2: misses/hits was not updated for var cache

git-svn-id: svn://svn.lighttpd.net/xcache/branches/1.2@377 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
1.2
Xuefer 2007-05-05 11:09:28 +00:00
parent 0339491d77
commit c75bf00410
2 changed files with 17 additions and 0 deletions

1
NEWS
View File

@ -6,6 +6,7 @@
== ChangeLog ==
* #86: remove/edit variable in admin page
* fixed #77: hits/misses was not updated
* fixed #56: xcache_set segfaults when xcache.var_size=0
========

View File

@ -1767,6 +1767,7 @@ PHP_FUNCTION(xcache_get)
xc_entry_t xce, *stored_xce;
xc_entry_data_var_t var;
zval *name;
int found = 0;
if (!xc_var_caches) {
VAR_DISABLED_WARNING();
@ -1783,6 +1784,7 @@ PHP_FUNCTION(xcache_get)
stored_xce = xc_entry_find_dmz(&xce TSRMLS_CC);
if (stored_xce) {
if (!VAR_ENTRY_EXPIRED(stored_xce)) {
found = 1;
xc_processor_restore_zval(return_value, stored_xce->data.var->value, stored_xce->have_references TSRMLS_CC);
/* return */
break;
@ -1794,6 +1796,12 @@ PHP_FUNCTION(xcache_get)
RETVAL_NULL();
} LEAVE_LOCK(xce.cache);
if (found) {
xce.cache->hits ++;
}
else {
xce.cache->misses ++;
}
}
/* }}} */
/* {{{ proto bool xcache_set(string name, mixed value [, int ttl])
@ -1840,6 +1848,7 @@ PHP_FUNCTION(xcache_isset)
xc_entry_t xce, *stored_xce;
xc_entry_data_var_t var;
zval *name;
int found = 0;
if (!xc_var_caches) {
VAR_DISABLED_WARNING();
@ -1856,6 +1865,7 @@ PHP_FUNCTION(xcache_isset)
stored_xce = xc_entry_find_dmz(&xce TSRMLS_CC);
if (stored_xce) {
if (!VAR_ENTRY_EXPIRED(stored_xce)) {
found = 1;
RETVAL_TRUE;
/* return */
break;
@ -1867,6 +1877,12 @@ PHP_FUNCTION(xcache_isset)
RETVAL_FALSE;
} LEAVE_LOCK(xce.cache);
if (found) {
xce.cache->hits ++;
}
else {
xce.cache->misses ++;
}
}
/* }}} */
/* {{{ proto bool xcache_unset(string name)