If compiled with MMAP support by using --enable-mmap this is the
mktemp-style file_mask to pass to the mmap module for determing whether
your mmap'ed memory region is going to be file-backed or shared memory
backed. For straight file-backed mmap, set it to something
like/tmp/apc.XXXXXX (exactly 6 Xs). To use POSIX-style shm_open/mmap put
a .shm somewhere in your mask. e.g. /apc.shm.XXXXXX You can also set it
to /dev/zero to use your kernel's/dev/zero interface to anonymous
mmap'ed memory. Leaving it undefined will force an anonymous mmap. apc.slam_defense 整型
APC will probably be 20-30% faster, but if you are writing to it frequently it can cause problems. The APC cache is best for things that change very rarely. And by very rarely I mean days, not hours or minutes.
Because of the way APC does an anonymous file-backed mmap where I unlink the file at startup to get process-death protection, it isn’t easy to get at the cache from a separate standalone command line script. That can be solved by mmap’ing slightly differently, but in the default config your approach won’t work.
-Rasmus
就是说APC不适合用于频繁写的场合,你最好只用它来保存那种几天都不会更改的内容。否则出了莫名其妙的问题就不好怎么解释了。
在以前的应用中,我确实有将apc用在频繁写的场合,偶尔会出现内存耗尽,进而引起所有http请求卡死,形式一发不可收拾整个服务器当掉。所以现在我仅仅用apc来缓存opcode的php代码,不在程序中显式的调用它,算是相安无事。