You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently trying to improve the speed of our controller and stumbled over something unexpected. We're currently adding a custom driver to PhpFastCache (with CacheManager::addCoreDriverOverride) and this calls internally CacheManager::getDriverList().
The method "CacheManager::getDriverList()" currently needs ~60ms on our development server. Yes this harddrive on this server is pretty slow - but why does this method work like this at all - in a library which you only want to use if you want to improve your speed.
Currently the CacheManager::getDriverList() method walks recursively over all files in the Drivers directory and then loads ALL php files in these completly into the memory and tokenizes them. Just to generate a list of classes which are always the same (at least if you don't change driver directory). This logic is probably a relict of the old way extension where added - but as far as I see this is no longer the case.
Can we please fix this?
Currently I see two ways to simply fix this:
Replace this logic in getDriverList() by a simple hardcoded list of drivers.
Add an option to insert the list from outside - something like CacheManager::setDriverList()
The text was updated successfully, but these errors were encountered:
Replace this logic in getDriverList() by a simple hardcoded list of drivers.
This method was created because, in its old days, from one version to another, before extensions mechanism, the driver list could have changed periodically due to incompatibility or deprecations.
So I decided to discover it automatically using a former Symfony Component (ClassLoader) that I embedded into the core.
Add an option to insert the list from outside - something like CacheManager::setDriverList()
It is internally set and not meant to be set from the outside.
You right, I need to rework this method, either to harcode the driver list (but I'm not a fan) or find a better efficient way to discover core drivers.
I'll take a look this weekend.
In the meantime, you can extend the CacheManager to rewrite ::getDriversList().
What type of issue is this?
Other (Please Specify)
Operating system + version
Ubuntu 22.04
PHP version
8.2.24
Connector/Database version (if applicable)
No response
Phpfastcache version
9.2.0 ✅
Describe the issue you're facing
I'm currently trying to improve the speed of our controller and stumbled over something unexpected. We're currently adding a custom driver to PhpFastCache (with CacheManager::addCoreDriverOverride) and this calls internally CacheManager::getDriverList().
The method "CacheManager::getDriverList()" currently needs ~60ms on our development server. Yes this harddrive on this server is pretty slow - but why does this method work like this at all - in a library which you only want to use if you want to improve your speed.
Currently the CacheManager::getDriverList() method walks recursively over all files in the Drivers directory and then loads ALL php files in these completly into the memory and tokenizes them. Just to generate a list of classes which are always the same (at least if you don't change driver directory). This logic is probably a relict of the old way extension where added - but as far as I see this is no longer the case.
Can we please fix this?
Currently I see two ways to simply fix this:
The text was updated successfully, but these errors were encountered: