+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
- | Copyright (c) 2006 The PHP Group |
+ | Copyright (c) 2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
*/
-/* $Id: php_apc.c,v 3.154.2.2 2008/03/28 18:35:41 gopalv Exp $ */
+/* $Id: php_apc.c,v 3.154.2.5 2008/05/11 18:57:00 rasmus Exp $ */
#include "apc_zend.h"
#include "apc_cache.h"
#else
php_info_print_table_row(2, "Locking type", "File Locks");
#endif
- php_info_print_table_row(2, "Revision", "$Revision: 3.154.2.2 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 3.154.2.5 $");
php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__);
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
HANDLE_BLOCK_INTERRUPTIONS();
APCG(mem_size_ptr) = &mem_size;
- APCG(current_cache) = apc_user_cache;
if (!(entry = apc_cache_make_user_entry(strkey, strkey_len + 1, val, ttl))) {
APCG(mem_size_ptr) = NULL;
- APCG(current_cache) = NULL;
+ apc_cache_expunge(apc_cache,t);
+ apc_cache_expunge(apc_user_cache,t);
HANDLE_UNBLOCK_INTERRUPTIONS();
return 0;
}
if (!apc_cache_make_user_key(&key, strkey, strkey_len + 1, t)) {
APCG(mem_size_ptr) = NULL;
- APCG(current_cache) = NULL;
apc_cache_free_entry(entry);
+ /* make_user_key doesn't allocate anything, so no expunge */
HANDLE_UNBLOCK_INTERRUPTIONS();
return 0;
}
if (!apc_cache_user_insert(apc_user_cache, key, entry, t, exclusive TSRMLS_CC)) {
apc_cache_free_entry(entry);
APCG(mem_size_ptr) = NULL;
- APCG(current_cache) = NULL;
+ /*
+ No expunge here - user_insert can fail for non-memory related reasons
+ The alloc-based expunge hook in 3.1 will do a better job here
+ (removing the expunge here also fixes bug #13336)
+ */
HANDLE_UNBLOCK_INTERRUPTIONS();
return 0;
}
APCG(mem_size_ptr) = NULL;
- APCG(current_cache) = NULL;
HANDLE_UNBLOCK_INTERRUPTIONS();