简体   繁体   中英

Php Zend Opcache caching include files

I guess I've got some doubts on how "Zend Opcache" actually works, I'm wondering how am I supposed to save in cache only the files I include trough the PHP include() method? It seems that even not specifying opcache_compile_file() all files are cached, "index.php" included, that I don't want to be. In fact all variables that I assign in index are not refreshed for each session but I only see the cached version of index. Can anyone explain? Thanks in advance

Zend OpCache is only a cache for PHP's opcodes and saves the processor from having to convert source code to opcodes until it (the source code) changes. If you need userland caching for data that your script uses, use APCu. When you say your vairables are not refreshed, do you have a reverse proxy in front of your web server?

I used to have the same problem and I came up with this solution: in the opcache configurations I set opcache.blacklist_filename to the path of an external blacklist file where I wrote the names of the classes I didn't want to be cached. See the documentation here for further details http://www.php.net/manual/en/opcache.configuration.php#ini.opcache.blacklist-filename

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM