zendtech / ZendOptimizerPlus

Other
915 stars 142 forks source link

Feature request: opcache_evict #234

Open if-kenn opened 6 years ago

if-kenn commented 6 years ago

With the use of frameworks like Symphony, and the use of composer, many PHP apps are literally more than 10,000 php files like Drupal 8 which is based on Symphony.

I understand that OpCache does not want to implement any kind of automatic eviction algorithms. That said, adding a function like:

bool opcache_invalidate ( string $script )

Would allow eviction to be self-managed. There might be some architectural reason something like this does not already exist, but if there is not I would very much like to be able to throw scripts out of cache to make room for more recently used scripts.

Thanks for consideration.

nikic commented 6 years ago

This is technically impossible within the current architecture. The only way to actually free up space (in a way that allows it to be reused) is through an opcache restart.