Re: APC & Custom streams
| From: | Rasmus Lerdorf | Date: | Fri, 23 Sep 2005 19:39:37 +0000 |
| Subject: | Re: APC & Custom streams | ||
| References: | 1 2 3 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-2972@lists.php.net to get a copy of this message | ||
Sara Golemon wrote:
>>>Does APC support caching PHP files which are included/required from
>>>non-file urls? e.g., if i define a custom url scheme, e.g.
>>>module://utils/main.inc, will APC cache includes/requires of such
>>>urls?
>>
>>It can't really do that. APC does a stat() on the script file to get
>>file's device, inode and mtime. Based on this it inserts the opcodes
>>into the cache hashed on device+inode and it uses the mtime to determine
>>if it should replace the opcodes if they are already there.
>>
>
> Do I understand you to mean that *if* a wrapper implements url_stat() and
> *if* the stat_buf is populated with, at minimum, those three elements that
> APC will cache?
I don't use a wrapper here. The code in question is in
pecl/apc/apc_cache.c and it looks like this:
if(!strcmp(SG(request_info).path_translated, filename)) {
tmp_buf = sapi_get_stat(TSRMLS_C); /* Apache has already done
this stat() for us */
}
if(tmp_buf) {
buf = *tmp_buf;
} else {
if (apc_stat(filename, &buf) != 0 && apc_stat_paths(filename,
include_path, &buf) != 0) {
So, for the top-level script I get the stat struct from Apache via
sapi_get_stat(). For included files I use apc_stat() which just does a
normal stat() call. This would have to be changed to use the wrapper
code for it to have any chance of working.
-Rasmus