I have a class which includes mysql link and others. I create an object of this class when I load the front page, but I don’t want to create again when I reload the page.
mysql cannot be stored in session, so is there any other way to keep the object globally?
I think what you want is persistent database connections.
This requires slightly reworking your connection code, but then you don’t manually manage the persistence (i.e. you don’t manually put something in the session).
Make sure you read up plenty before moving forward, though. There are a lot of implications.