Search code examples
phpopcache

opcache_is_script_cached function in php5.5.11


Recently I asked a question "is there a way to find if the script was hit by opCache" and was not able to find an answer. Right now looking at changelog of Php5.5.11, I found that the new function

OPCache:

Added function opcache_is_script_cached().

was added. Based on the name it is doing exactly what I want, but the problem is that I can not find any documentation on this function.

Can anyone tell me exactly what this function does? Please refrain from wild guesses.


Solution

  • After reading this post (and some other PHP manual notes), I recognized that the function had still yet to be documented. Anyway, I've taken the small bit of time recently to add this function to the PHP documentation:

    http://php.net/manual/en/function.opcache-is-script-cached.php

    An excerpt from the manual:

    opcache_is_script_cached — Tells whether a script is cached in OPCache

    boolean opcache_is_script_cached ( string $file )

    This function checks if a PHP script has been cached in OPCache. This can be used to more easily detect the "warming" of the cache for a particular script.

    Returns TRUE if $file is cached in OPCache, FALSE otherwise.