Beware that only existing files can be invalidated.
Instead of removing a file from opcache that you have delete, you need to call opcache_invalidate before deleting it.opcache_invalidate
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
opcache_invalidate
Референца за `function.opcache-invalidate.php` со подобрена типографија и навигација.
opcache_invalidate
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache >= 7.0.0)
opcache_invalidate — Оневозможува кеширана скрипта
= NULL
Оваа функција оневозможува одредена скрипта од кешот на opcode. Ако
force не е поставено или false, скриптата ќе биде оневозможена само ако времето на модификација на скриптата е поново од кешираните opcodes. Оваа функција оневозможува само кеш во меморија, а не кеш од датотека.
Параметри
filename- Патеката до скриптата што се оневозможува.
force-
Ако е поставено на
true, скриптата ќе биде оневозможена без оглед на тоа дали е потребно оневозможување.
Вратени вредности
Патеката до PHP скриптата што треба да се провери. true ако opcode кешот за filename беше оневозможен или ако немаше ништо за оневозможување, или false ако opcode кешот е оневозможен.
Види Исто така
- opcache_compile_file() е кеширана во OPCache кеш во меморија,
- opcache_reset() - Ги ресетира содржините на кешот на опкод
Белешки од корисници 3 белешки
Note that invalidation doesn't actually evict anything from the cache, it just forces a recompile. You can verify this by calling opcache_get_status() and seeing that the invalidated script is not actually removed from "scripts". This means it cannot be used as a more graceful alternative to opcache_reset() when the cache is full ("cache_full":true in status). The cache will eventually fill up and refuse to cache new requests if you do atomic deployment of PHP code by changing the web server's document root. It appears opcache_reset() is the only way to prevent this, but opcache_reset() can disable the cache for any amount of time while attempting to restart, causing load spikes.opcache_invalidate tries to acquire SHM lock. When the lock can not be acquired opcache_invalidate will return FALSE. During multiple concurrent opcache_invalidate calls with higher probability, the function will return FALSE.