I want to create a C++(11) container (boost can be used) that will hold database connections. I would like to be able to push in the container the connection pointer, however std::vector does not know the insertion time so I can used something like this.
-
When the connection starts execution it will also pushed in the container with the time now().
If the connection finishes the job in the db the connection will be erased from the container.
Ideally my class will have a cleanup method that will check periodically if a connection is in the container for more than a specific time interval, ie 30 sec. If it is true the connection will be released from the database.
Any ideas, is there any standard solution?
Aucun commentaire:
Enregistrer un commentaire