API Reference Guide > Zend OPcache PHP API

Zend OPcache - PHP API

This topic lists the PHP API functions of the Zend OPcache.

Zend OPcache Functions

Function

Description

opcache_compile_file

Compiles and caches a PHP script without executing it.

opcache_get_configuration

Returns configuration information about the cache instance.

opcache_get_status

Returns state information about the cache instance.

opcache_invalidate

invalidates a particular script from the opcode cache. If force is unset or FALSE, the script will only be invalidated if the modification time of the script is newer than the cached opcodes.

opcache_reset

Resets the entire opcode cache. After calling opcache_reset(), all scripts will be reloaded and reparsed the next time they are hit.

opcache_compile_file

Compiles and caches a PHP script without executing it.

Available Since Version: 6.3

Parameter

Type

Required

Description

file

string

Yes

The path to the PHP script to be compiled.

Return Value: boolean - Returns TRUE if file was compiled successfully or FALSE on failure.

opcache_get_configuration

Returns configuration information about the cache instance.

Available Since Version: 6.3

Return Value: array - Returns an array of information, including ini, blacklist and version.

opcache_get_status

Returns state information about the cache instance.

Available Since Version: 6.3

Parameter

Type

Required

Description

get_scripts

string

Yes

Include script specific state information.

Return Value: array - Returns an array of information, optionally containing script specific state information.

opcache_invalidate

invalidates a particular script from the opcode cache. If force is unset or FALSE, the script will only be invalidated if the modification time of the script is newer than the cached opcodes.

Available Since Version: 6.3

Parameter

Type

Required

Description

script

string

Yes

The path to the script being invalidated.

force

string

Yes

If set to TRUE, the script will be invalidated regardless of whether invalidation is necessary.

Return Value: boolean - Returns TRUE if the opcode cache for script was invalidated or if there was nothing to invalidate, or FALSE if the opcode cache is disabled.

opcache_reset

Resets the entire opcode cache. After calling opcache_reset(), all scripts will be reloaded and reparsed the next time they are hit.

Available Since Version: 6.3

Return Value: boolean - Returns TRUE if the opcode cache was reset, or FALSE if the opcode cache is disabled.