![]() |
Object Aggregation
I'm using a Database Connection class in a web app I am writing as I find myself calling the same functions often.
I was looking into using Aggregation in order to achieve this when I came across this article: Page 2 - Object Interaction in PHP: Introduction to Aggregation, part 1 But it says: Quote:
Thanks Jen |
I'm not sure if this is exactly what you're asking, but you're system should be programmed in such a way that every time a unique visitor accesses a page, there should only ever be one distinct connection to the database (not multiple connections for the same visitor). If you're opening a connection three times for a single page view, there's something wrong - a hundred visitors, a hundred connections, there's no avoiding that, and your server will have to be able to handle the load.
-m |
I'm not quite sure why aggregation per se would be the cause of this, but bad design would.
If your system is managing to open multiple database connections per execution there is defiantly something wrong. A singleton DB connection class would combat this somewhat: PHP Code:
PHP Code:
|
| All times are GMT. The time now is 06:56 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0