What does apc.preload_path do in the APC settings?
Just curious. It's undoc开发者_StackOverflow社区umented in the manual here.
Maybe someone who is familiar with the APC source code can explain?
It specifies a directory from which APC loads cache data on startup. In a large setup (think 100+ servers), this would allow you to forgo compiling php files. You could also supply your own compilations if you were somehow smarter than APC and the php compiler, or other kinds of default data.
Apart from this one occurence, it's unused. Unless you have one of the problems described above, you should not set it.
At the moment of writing this option is broken because of a bug in the APC source code which will not allow you to properly preload the cache.
Inside 'main_apc.c
' in the method called 'static int apc_load_data(const char *data_file TSRMLS_DC)
', the length of the key of the value that needs to be stored is determined with the following line :
key_len = strlen(key);
If I am correct this is only the length of the string itself without the null-terminator
However, "_apc_store
" seems to want the length of the key string including the terminator.
If I change the line above to :
key_len = strlen(key)+1;
then the preload function works as expected.
You can also notice that 1 character is missing when looking at the user cache entries apc.php. But if you try to use that as a key then APC will not return the contents so that didn't work as a workaround.
精彩评论