I have a database class which I use throughout my application, now to me it doesn't make much sense to create a new variable and instance of the class to handle some operations. How would I go about doing something as in having maybe another class...(or module?) that would return me a reference to my database object if one exists, otherwise creating a new instance if it doesn't?

Bascially, i'd like to be able to have one going, and anywhere I need it to just say db.func().

Any ideas?