[eluser]Unknown[/eluser]
I have a library that I wrote and it is specified in the autoload array. When a page is loaded, the library loads multiple times. Why do I think this is happening? In the library constructor I have a simple function that writes a string with a timestamp to a text file.
My first thought was that it is because of function calls to the library file in the various controllers, models or views being used to display a particular page. Removing those calls appeared to make no difference - the same number of log entries appeared.
After a bit of trial and error, I discovered that commenting out database calls reduced the number of times that the library was reloaded. It would appear that everytime a database call is made, the libraries are reloaded.
I guess this is normal behaviour, but if anyone can explain why, then I would be interested to know. Thanks!