equal
deleted
inserted
replaced
1 --- APC-3.0.19/apc_main.c.ORIG Fri Feb 13 17:16:08 2009 |
|
2 +++ APC-3.0.19/apc_main.c Fri Feb 13 17:16:18 2009 |
|
3 @@ -378,21 +378,12 @@ |
|
4 if (op_array == NULL) { |
|
5 return NULL; |
|
6 } |
|
7 - /* |
|
8 - * Basically this will cause a file only to be cached on a percentage |
|
9 - * of the attempts. This is to avoid cache slams when starting up a |
|
10 - * very busy server or when modifying files on a very busy live server. |
|
11 - * There is no point having many processes all trying to cache the same |
|
12 - * file at the same time. By introducing a chance of being cached |
|
13 - * we theoretically cut the cache slam problem by the given percentage. |
|
14 - * For example if apc.slam_defense is set to 66 then 2/3 of the attempts |
|
15 - * to cache an uncached file will be ignored. |
|
16 - */ |
|
17 - if(APCG(slam_defense)) { |
|
18 - if(APCG(slam_rand)==-1) { |
|
19 - APCG(slam_rand) = (int)(100.0*rand()/(RAND_MAX+1.0)); |
|
20 - } |
|
21 - if(APCG(slam_rand) < APCG(slam_defense)) { |
|
22 + |
|
23 + /* check our regular expression filters */ |
|
24 + if (APCG(filters) && apc_compiled_filters && h->opened_path) { |
|
25 + int ret = apc_regex_match_array(apc_compiled_filters, h->opened_path); |
|
26 + if(ret == APC_NEGATIVE_MATCH || (ret != APC_POSITIVE_MATCH && !APCG(cache_by_default))) { |
|
27 + /* never cache, never find */ |
|
28 return op_array; |
|
29 } |
|
30 } |
|