Patch #1321
closedPrecache all settings
0%
Description
While setting up my local development environment to have a look at bug #1313, I noticed that the database was hit multiple times to read settings - once per setting. This seems like an awfully stupid thing to do, as multiple settings usually need to get read anyways.
Also, there is a caching mechanism in place, but it only works for multiple reads of the same value per request. Also, there is code to check for settings cache freshness and flushing the cache, but the cache-flushing function is called once per request and the cache works for one request only anyways.
This lead me to devise the two attached patches. One (0001) preloads all settings into another class variable, the other (0002) gets rid of all the caching as it is not needed any more due to the settings being preloaded anyways.
This could be further improved by batch-loading the needed settings but it would require them to be known beforehand, otherwise we would get the old behaviour.
I know it's cosmetics, but still...
Files
Updated by Philip Hofstetter over 16 years ago
the patches are, btw., also available at http://www.pilif.ch/redmine where I'll add other stuff as it surfaces.
Updated by Jean-Philippe Lang over 16 years ago
Philip,
the settings cache system is working but it's not designed to be efficient when running in development mode.
Please, run the application in production mode and enable the sql log if you want to understand how it works.