Auto create object on start zope instance

Hello,
I am using Products.TemporaryFolder 6.2 to store the Transient Object Container object to manage sessions. However, when restarting the zope instance, the temporary folder is emptied. this is normal, but annoying for a production site with automated restarts. In zope2, the Transient Object Container object, was well preserved (or rebuilt?) on restart.
Can you tell me if we can trigger the automatic creation of object in the ZODB when starting an instance?
thanks in advance

You could put the sessions into a FileStorage. In your Zope root, you will find an object (it has session in its name) which provides the primary session configuration. There, you could put the session data elsewhere (e.g. into the main storage).

Modern Zope versions notify an zope.processlifetime.IDatabaseOpenedWithRoot event at the end of process startup. You can extend the setup in a subscriber for this event.

An alternative is to leverage Beaker session management into Zope, like with collective.beaker. It just does not seem to be upgraded for Python 3 and Zope 4/5. Given the relatively simple code base, this should be kind of easy (we love Pull Requests).

beaker become very slow with too many cache in file system. A lesson learned, I am moving away from beaker.

For information, due to problems with Tempory folder, which loses the session_data object, we have abandoned the use of Tempory Folder.
The latest version of Tempory folder therefore does not correct data loss bugs.

I did not use it for caching only for sessions.
But: Indeed. I would not recommend fie as backend for Beaker. Performance with ext:memcached or ext:redis is way better. I did not try other options so far. But it's been a while I used it. These days I do not use sessions anywhere. Storing state in browser (localstorage) and passing state with the request (if needed) works fine for my cases and saves headaches.