...

View Full Version : How to use caching in php



umen242
03-03-2009, 04:11 PM
Hello all
im new to php and server scripting ( coming from the java/cpp background )
my question is , if i like to be able to build some kind of single tone cache that will hold me data in memory in all the web application
life , what are my options ?

Fumigator
03-03-2009, 04:14 PM
Sessions.

http://us2.php.net/manual/en/book.session.php

umen242
03-03-2009, 04:52 PM
i meant something that when i start the web server it will start main cache
that will server the web application not inside sessions static cache
like singletone map in c++/java that that leaves all the time

Fou-Lu
03-03-2009, 08:24 PM
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.


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.

umen242
03-04-2009, 04:43 AM
yeah i know that in jsp / java back end i cando that .
so tiy telling me that in php i can't do global cache ?

Fou-Lu
03-04-2009, 01:17 PM
yeah i know that in jsp / java back end i cando that .
so tiy telling me that in php i can't do global cache ?

No, PHP was designed to handle single page loads. There may already be some caching extensions made, but you'd have to take a look around.

eak
03-04-2009, 04:09 PM
What about MemCache (http://us2.php.net/memcache)?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum