Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-03-2009, 03:11 PM   PM User | #1
umen242
Regular Coder

 
Join Date: Jan 2008
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
umen242 is an unknown quantity at this point
How to use caching in php

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 ?
umen242 is offline   Reply With Quote
Old 03-03-2009, 03:14 PM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Sessions.

http://us2.php.net/manual/en/book.session.php
__________________
Fumigator is offline   Reply With Quote
Old 03-03-2009, 03:52 PM   PM User | #3
umen242
Regular Coder

 
Join Date: Jan 2008
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
umen242 is an unknown quantity at this point
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
umen242 is offline   Reply With Quote
Old 03-03-2009, 07:24 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,648
Thanks: 4
Thanked 2,450 Times in 2,419 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php

Last edited by Fou-Lu; 03-03-2009 at 07:29 PM..
Fou-Lu is offline   Reply With Quote
Old 03-04-2009, 03:43 AM   PM User | #5
umen242
Regular Coder

 
Join Date: Jan 2008
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
umen242 is an unknown quantity at this point
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 ?
umen242 is offline   Reply With Quote
Old 03-04-2009, 12:17 PM   PM User | #6
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,648
Thanks: 4
Thanked 2,450 Times in 2,419 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Quote:
Originally Posted by umen242 View Post
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.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 03-04-2009, 03:09 PM   PM User | #7
eak
Regular Coder

 
eak's Avatar
 
Join Date: Jun 2002
Location: Nashville, TN
Posts: 354
Thanks: 0
Thanked 26 Times in 26 Posts
eak is on a distinguished road
What about MemCache?
__________________
eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."
eak is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:57 PM.


Advertisement
Log in to turn off these ads.