PHP probably isn't what you're looking for.
The best I can think of is to create a pool in you're database, and use a persistent connection. Still not the same.
What you're describing is more like JSP.
Edit:
I should actually clarify this.
There is no real good 'caching' method using standard PHP. You can write extensions in C that make use of much better caching methods, and load them into you're PHP scripts instead. Yeah, that would probably work out pretty good.