Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jan 2008
    Posts
    131
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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 ?

  2. #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts

  3. #3
    Regular Coder
    Join Date
    Jan 2008
    Posts
    131
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  4. #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    17,027
    Thanks
    4
    Thanked 2,668 Times in 2,637 Posts
    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.
    Last edited by Fou-Lu; 03-03-2009 at 08:29 PM.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  5. #5
    Regular Coder
    Join Date
    Jan 2008
    Posts
    131
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 ?

  6. #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    17,027
    Thanks
    4
    Thanked 2,668 Times in 2,637 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  7. #7
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    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."


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •