cvs: pecl /apc INSTALL apc_cache.c apc_cache.h apc_globals.h apc_main.c php_apc.c

From: Date: Thu, 12 Aug 2004 16:50:17 +0000
Subject: cvs: pecl /apc INSTALL apc_cache.c apc_cache.h apc_globals.h apc_main.c php_apc.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-1636@lists.php.net to get a copy of this message
rasmus Thu Aug 12 12:50:17 2004 EDT Modified files: /pecl/apc INSTALL apc_cache.c apc_cache.h apc_globals.h apc_main.c php_apc.c Log: Oops, I fat-fingered that previous commit prematurely. Backing it back out

http://cvs.php.net/diff.php/pecl/apc/INSTALL?r1=3.35&r2=3.36&ty=u Index: pecl/apc/INSTALL diff -u pecl/apc/INSTALL:3.35 pecl/apc/INSTALL:3.36 --- pecl/apc/INSTALL:3.35 Thu Aug 12 12:32:02 2004 +++ pecl/apc/INSTALL Thu Aug 12 12:50:17 2004 @@ -222,14 +222,6 @@ many thousands of source files. (Default: 1000) - apc.ttl The number of seconds a cache entry is allowed to - idle in a slot in case this cache entry slot is - needed by another entry. Leaving this at zero - means that your cache could potentially fill up - with stale entries while newer entries won't be - cached. - (Default: 0) - apc.gc_ttl The number of seconds that a cache entry may remain on the garbage-collection list. This value provides a failsafe in the event that a server http://cvs.php.net/diff.php/pecl/apc/apc_cache.c?r1=3.56&r2=3.57&ty=u Index: pecl/apc/apc_cache.c diff -u pecl/apc/apc_cache.c:3.56 pecl/apc/apc_cache.c:3.57 --- pecl/apc/apc_cache.c:3.56 Thu Aug 12 12:32:02 2004 +++ pecl/apc/apc_cache.c Thu Aug 12 12:50:17 2004 @@ -14,16 +14,12 @@ +----------------------------------------------------------------------+ */ -/* $Id: apc_cache.c,v 3.56 2004/08/12 16:32:02 rasmus Exp $ */ +/* $Id: apc_cache.c,v 3.57 2004/08/12 16:50:17 rasmus Exp $ */ #include "apc_cache.h" #include "apc_lock.h" #include "apc_sma.h" #include "SAPI.h" -#if HAVE_APACHE -#include "httpd.h" -#endif - /* TODO: rehash when load factor exceeds threshold */ @@ -43,7 +39,6 @@ int num_hits; /* number of hits to this bucket */ time_t creation_time; /* time slot was initialized */ time_t deletion_time; /* time slot was removed from cache */ - time_t access_time; /* time slot was last accessed */ }; /* }}} */ @@ -64,7 +59,6 @@ slot_t** slots; /* array of cache slots (stored in SHM) */ int num_slots; /* number of slots in cache */ int gc_ttl; /* maximum time on GC list for a slot */ - int ttl; /* if slot is needed and entry's mtime is older than this ttl, remove it */ int lock; /* global semaphore lock */ }; /* }}} */ @@ -83,22 +77,13 @@ /* {{{ make_slot */ slot_t* make_slot(apc_cache_key_t key, apc_cache_entry_t* value, slot_t* next) { - time_t t; slot_t* p = apc_sma_malloc(sizeof(slot_t)); if (!p) return NULL; -#if HAVE_APACHE - /* Save a syscall here under Apache. This should actually be a SAPI call instead - * but we don't have that yet. Once that is introduced in PHP this can be cleaned up -Rasmus */ - t = ((request_rec *)SG(server_context))->request_time; -#else - t = time(0); -#endif p->key = key; p->value = value; p->next = next; p->num_hits = 0; - p->creation_time = t; - p->access_time = t; + p->creation_time = time(0); p->deletion_time = 0; return p; } @@ -195,7 +180,7 @@ /* }}} */ /* {{{ apc_cache_create */ -apc_cache_t* apc_cache_create(int size_hint, int gc_ttl, int ttl) +apc_cache_t* apc_cache_create(int size_hint, int gc_ttl) { apc_cache_t* cache; int cache_size; @@ -218,7 +203,6 @@ cache->slots = (slot_t**) (((char*) cache->shmaddr) + sizeof(header_t)); cache->num_slots = num_slots; cache->gc_ttl = gc_ttl; - cache->ttl = ttl; cache->lock = CREATE_LOCK; for (i = 0; i < num_slots; i++) { @@ -265,7 +249,6 @@ apc_cache_entry_t* value) { slot_t** slot; - time_t t; if (!value) { return 0; @@ -275,15 +258,6 @@ process_pending_removals(cache); slot = &cache->slots[hash(key) % cache->num_slots]; - if(*slot) { -#if HAVE_APACHE - /* Save a syscall here under Apache. This should actually be a SAPI call instead - * but we don't have that yet. Once that is introduced in PHP this can be cleaned up -Rasmus */ - t = ((request_rec *)SG(server_context))->request_time; -#else - t = time(0); -#endif - } while (*slot) { if (key_equals((*slot)->key, key)) { if ((*slot)->key.mtime < key.mtime) { @@ -292,9 +266,6 @@ } UNLOCK(cache); return 0; - } else if(cache->ttl && (*slot)->access_time < (t - cache->ttl)) { - remove_slot(cache, slot); - continue; } slot = &(*slot)->next; } @@ -313,20 +284,10 @@ apc_cache_entry_t* apc_cache_find(apc_cache_t* cache, apc_cache_key_t key) { slot_t** slot; - time_t t; LOCK(cache); slot = &cache->slots[hash(key) % cache->num_slots]; - if(*slot) { -#if HAVE_APACHE - /* Save a syscall here under Apache. This should actually be a SAPI call instead - * but we don't have that yet. Once that is introduced this can be cleaned up -Rasmus */ - t = ((request_rec *)SG(server_context))->request_time; -#else - t = time(0); -#endif - } while (*slot) { if (key_equals((*slot)->key, key)) { if ((*slot)->key.mtime < key.mtime) { @@ -336,7 +297,6 @@ (*slot)->num_hits++; (*slot)->value->ref_count++; - (*slot)->access_time = t; prevent_garbage_collection((*slot)->value); cache->header->num_hits++; @@ -435,7 +395,6 @@ info = (apc_cache_info_t*) apc_emalloc(sizeof(apc_cache_info_t)); info->num_slots = cache->num_slots; - info->ttl = cache->ttl; info->num_hits = cache->header->num_hits; info->num_misses = cache->header->num_misses; info->list = NULL; @@ -455,7 +414,6 @@ link->mtime = p->key.mtime; link->creation_time = p->creation_time; link->deletion_time = p->deletion_time; - link->access_time = p->access_time; link->ref_count = p->value->ref_count; link->next = info->list; info->list = link; @@ -474,7 +432,6 @@ link->mtime = p->key.mtime; link->creation_time = p->creation_time; link->deletion_time = p->deletion_time; - link->access_time = p->access_time; link->ref_count = p->value->ref_count; link->next = info->deleted_list; info->deleted_list = link; http://cvs.php.net/diff.php/pecl/apc/apc_cache.h?r1=3.15&r2=3.16&ty=u Index: pecl/apc/apc_cache.h diff -u pecl/apc/apc_cache.h:3.15 pecl/apc/apc_cache.h:3.16 --- pecl/apc/apc_cache.h:3.15 Thu Aug 12 12:32:02 2004 +++ pecl/apc/apc_cache.h Thu Aug 12 12:50:17 2004 @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: apc_cache.h,v 3.15 2004/08/12 16:32:02 rasmus Exp $ */ +/* $Id: apc_cache.h,v 3.16 2004/08/12 16:50:17 rasmus Exp $ */ #ifndef APC_CACHE_H #define APC_CACHE_H @@ -63,12 +63,8 @@ * gc_ttl is the maximum time a cache entry may speed on the garbage * collection list. This is basically a work around for the inherent * unreliability of our reference counting mechanism (see apc_cache_release). - * - * ttl is the maximum time a cache entry can idle in a slot in case the slot - * is needed. This helps in cleaning up the cache and ensuring that entries - * hit frequently stay cached and ones not hit very often eventually disappear. */ -extern T apc_cache_create(int size_hint, int gc_ttl, int ttl); +extern T apc_cache_create(int size_hint, int gc_ttl); /* * apc_cache_destroy releases any OS resources associated with a cache object. @@ -160,7 +156,6 @@ time_t mtime; time_t creation_time; time_t deletion_time; - time_t access_time; int ref_count; apc_cache_link_t* next; }; @@ -172,7 +167,6 @@ int num_slots; int num_hits; int num_misses; - int ttl; apc_cache_link_t* list; apc_cache_link_t* deleted_list; }; http://cvs.php.net/diff.php/pecl/apc/apc_globals.h?r1=3.6&r2=3.7&ty=u Index: pecl/apc/apc_globals.h diff -u pecl/apc/apc_globals.h:3.6 pecl/apc/apc_globals.h:3.7 --- pecl/apc/apc_globals.h:3.6 Thu Aug 12 12:32:03 2004 +++ pecl/apc/apc_globals.h Thu Aug 12 12:50:17 2004 @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: apc_globals.h,v 3.6 2004/08/12 16:32:03 rasmus Exp $ */ +/* $Id: apc_globals.h,v 3.7 2004/08/12 16:50:17 rasmus Exp $ */ #ifndef APC_GLOBALS_H #define APC_GLOBALS_H @@ -31,7 +31,6 @@ int optimization; /* optimizer level (higher = more aggressive) */ int num_files_hint; /* parameter to apc_cache_create */ int gc_ttl; /* parameter to apc_cache_create */ - int ttl; /* parameter to apc_cache_create */ #if APC_MMAP char *mmap_file_mask; /* mktemp-style file-mask to pass to mmap */ #endif http://cvs.php.net/diff.php/pecl/apc/apc_main.c?r1=3.13&r2=3.14&ty=u Index: pecl/apc/apc_main.c diff -u pecl/apc/apc_main.c:3.13 pecl/apc/apc_main.c:3.14 --- pecl/apc/apc_main.c:3.13 Thu Aug 12 12:32:03 2004 +++ pecl/apc/apc_main.c Thu Aug 12 12:50:17 2004 @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: apc_main.c,v 3.13 2004/08/12 16:32:03 rasmus Exp $ */ +/* $Id: apc_main.c,v 3.14 2004/08/12 16:50:17 rasmus Exp $ */ #include "apc_php.h" #include "apc_main.h" @@ -237,7 +237,7 @@ #else apc_sma_init(APCG(shm_segments), APCG(shm_size)*1024*1024); #endif - APCG(cache) = apc_cache_create(APCG(num_files_hint), APCG(gc_ttl), APCG(ttl)); + APCG(cache) = apc_cache_create(APCG(num_files_hint), APCG(gc_ttl)); APCG(cache_stack) = apc_stack_create(0); APCG(compiled_filters) = apc_regex_compile_array(APCG(filters)); http://cvs.php.net/diff.php/pecl/apc/php_apc.c?r1=3.29&r2=3.30&ty=u Index: pecl/apc/php_apc.c diff -u pecl/apc/php_apc.c:3.29 pecl/apc/php_apc.c:3.30 --- pecl/apc/php_apc.c:3.29 Thu Aug 12 12:32:03 2004 +++ pecl/apc/php_apc.c Thu Aug 12 12:50:17 2004 @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_apc.c,v 3.29 2004/08/12 16:32:03 rasmus Exp $ */ +/* $Id: php_apc.c,v 3.30 2004/08/12 16:50:17 rasmus Exp $ */ #ifdef PHP_WIN32 /* XXX lame hack, for some reason, the ini entries are all messed @@ -86,7 +86,6 @@ STD_PHP_INI_ENTRY("apc.optimization", "0", PHP_INI_SYSTEM, OnUpdateInt, optimization, zend_apc_globals, apc_globals) STD_PHP_INI_ENTRY("apc.num_files_hint", "1000", PHP_INI_SYSTEM, OnUpdateInt, num_files_hint, zend_apc_globals, apc_globals) STD_PHP_INI_ENTRY("apc.gc_ttl", "3600", PHP_INI_SYSTEM, OnUpdateInt, gc_ttl, zend_apc_globals, apc_globals) -STD_PHP_INI_ENTRY("apc.ttl", "0", PHP_INI_SYSTEM, OnUpdateInt, ttl, zend_apc_globals, apc_globals) #if APC_MMAP STD_PHP_INI_ENTRY("apc.mmap_file_mask", NULL, PHP_INI_SYSTEM, OnUpdateString, mmap_file_mask, zend_apc_globals, apc_globals) #endif @@ -108,7 +107,7 @@ #else php_info_print_table_row(2, "MMAP Support", "Disabled"); #endif - php_info_print_table_row(2, "Revision", "$Revision: 3.29 $"); + php_info_print_table_row(2, "Revision", "$Revision: 3.30 $"); php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__); DISPLAY_INI_ENTRIES(); php_info_print_table_end(); @@ -173,7 +172,6 @@ array_init(return_value); add_assoc_long(return_value, "num_slots", info->num_slots); - add_assoc_long(return_value, "ttl", info->ttl); add_assoc_long(return_value, "num_hits", info->num_hits); add_assoc_long(return_value, "num_misses", info->num_misses); @@ -193,7 +191,6 @@ add_assoc_long(link, "mtime", p->mtime); 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); add_assoc_long(link, "ref_count", p->ref_count); add_next_index_zval(list, link); } @@ -215,7 +212,6 @@ add_assoc_long(link, "mtime", p->mtime); 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); add_assoc_long(link, "ref_count", p->ref_count); add_next_index_zval(list, link); }
« previous php.pecl.cvs (#1636) next »