Patch apc-3.1.13-st_size for APC Bug #63838
Patch version 2012-12-23 07:12 UTC
Return to Bug #63838 |
Download this patch
Patch Revisions:
Developer: gxd305@gmail.com
diff -c APC-3.1.13/apc_cache.c APC-3.1.13-2/apc_cache.c
*** APC-3.1.13/apc_cache.c 2012-09-04 00:52:51.000000000 +0800
--- APC-3.1.13-2/apc_cache.c 2012-12-23 00:41:46.792185126 +0800
***************
*** 648,654 ****
if(key.type == (*slot)->key.type) {
if(key.type == APC_CACHE_KEY_FILE) {
if(key_equals((*slot)->key.data.file, key.data.file)) {
! if((*slot)->key.mtime != key.mtime) {
#if (USE_READ_LOCKS == 0)
/* this is merely a memory-friendly optimization, if we do have a write-lock
* might as well move this to the deleted_list right-away. Otherwise an insert
--- 648,654 ----
if(key.type == (*slot)->key.type) {
if(key.type == APC_CACHE_KEY_FILE) {
if(key_equals((*slot)->key.data.file, key.data.file)) {
! if((*slot)->key.mtime != key.mtime || (*slot)->key.st_size != key.st_size) {
#if (USE_READ_LOCKS == 0)
/* this is merely a memory-friendly optimization, if we do have a write-lock
* might as well move this to the deleted_list right-away. Otherwise an insert
***************
*** 1019,1024 ****
--- 1019,1025 ----
key->data.file.device = fileinfo->st_buf.sb.st_dev;
key->data.file.inode = fileinfo->st_buf.sb.st_ino;
+ key->st_size = fileinfo->st_buf.sb.st_size;
key->h = (unsigned long) key->data.file.device + (unsigned long) key->data.file.inode;
/*
***************
*** 1222,1227 ****
--- 1223,1229 ----
add_assoc_double(link, "num_hits", (double)p->num_hits);
add_assoc_long(link, "mtime", p->key.mtime);
+ add_assoc_long(link, "st_size", p->key.st_size);
add_assoc_long(link, "creation_time", p->creation_time);
add_assoc_long(link, "deletion_time", p->deletion_time);
add_assoc_long(link, "access_time", p->access_time);
diff -c APC-3.1.13/apc_cache.h APC-3.1.13-2/apc_cache.h
*** APC-3.1.13/apc_cache.h 2012-09-04 00:52:51.000000000 +0800
--- APC-3.1.13-2/apc_cache.h 2012-12-23 00:30:45.923189204 +0800
***************
*** 106,111 ****
--- 106,112 ----
apc_cache_key_data_t data;
unsigned long h; /* pre-computed hash value */
time_t mtime; /* the mtime of this cached entry */
+ off_t st_size;
unsigned char type;
unsigned char md5[16]; /* md5 hash of the source file */
};
diff -c APC-3.1.13/apc_iterator.c APC-3.1.13-2/apc_iterator.c
*** APC-3.1.13/apc_iterator.c 2012-09-04 00:52:51.000000000 +0800
--- APC-3.1.13-2/apc_iterator.c 2012-12-23 00:56:47.591173046 +0800
***************
*** 100,105 ****
--- 100,108 ----
#endif
}
}
+ if ((APC_ITER_ST_SIZE & iterator->format) && (slot->key.type == APC_CACHE_KEY_FILE)) {
+ add_assoc_long(item->value, "st_size", slot->key.st_size);
+ }
if (APC_ITER_KEY & iterator->format) {
add_assoc_stringl(item->value, "key", item->key, (item->key_len - 1), 1);
}
***************
*** 697,702 ****
--- 700,706 ----
zend_register_long_constant("APC_ITER_REFCOUNT", sizeof("APC_ITER_REFCOUNT"), APC_ITER_REFCOUNT, CONST_PERSISTENT | CONST_CS, module_number TSRMLS_CC);
zend_register_long_constant("APC_ITER_MEM_SIZE", sizeof("APC_ITER_MEM_SIZE"), APC_ITER_MEM_SIZE, CONST_PERSISTENT | CONST_CS, module_number TSRMLS_CC);
zend_register_long_constant("APC_ITER_TTL", sizeof("APC_ITER_TTL"), APC_ITER_TTL, CONST_PERSISTENT | CONST_CS, module_number TSRMLS_CC);
+ zend_register_long_constant("APC_ITER_ST_SIZE", sizeof("APC_ITER_ST_SIZE"), APC_ITER_TTL, CONST_PERSISTENT | CONST_CS, module_number TSRMLS_CC);
zend_register_long_constant("APC_ITER_NONE", sizeof("APC_ITER_NONE"), APC_ITER_NONE, CONST_PERSISTENT | CONST_CS, module_number TSRMLS_CC);
zend_register_long_constant("APC_ITER_ALL", sizeof("APC_ITER_ALL"), APC_ITER_ALL, CONST_PERSISTENT | CONST_CS, module_number TSRMLS_CC);
diff -c APC-3.1.13/apc_iterator.h APC-3.1.13-2/apc_iterator.h
*** APC-3.1.13/apc_iterator.h 2012-09-04 00:52:51.000000000 +0800
--- APC-3.1.13-2/apc_iterator.h 2012-12-23 00:44:30.953202924 +0800
***************
*** 59,64 ****
--- 59,65 ----
#define APC_ITER_REFCOUNT (1L << 12)
#define APC_ITER_MEM_SIZE (1L << 13)
#define APC_ITER_TTL (1L << 14)
+ #define APC_ITER_ST_SIZE (1L << 15)
#define APC_ITER_NONE (0x00000000L)
#define APC_ITER_ALL (0xffffffffL)
Common subdirectories: APC-3.1.13/tests and APC-3.1.13-2/tests
|