SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict ArunB's Avatar
    Join Date
    Jun 2008
    Location
    Hyderabad
    Posts
    252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Problem with memcache as the session handler

    I have configured memcache as the session handler.
    Code:
    session.save_handler = memcache
    session.save_path=tcp://192.168.0.1:11211
    And in a page, I am putting some value in a session variable, and the page has a link to the other PHP script, where the session value will be printed. But I am getting empty string there. How can I know if there is some problem with the Session save handler?

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you actually have a memcached daemon listening on that port?

  3. #3
    SitePoint Addict ArunB's Avatar
    Join Date
    Jun 2008
    Location
    Hyderabad
    Posts
    252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep, memcache is installed and running.

    Code:
    Distributed memory caching daemon
    memcached (pid 2503) is running...

  4. #4
    SitePoint Addict ArunB's Avatar
    Join Date
    Jun 2008
    Location
    Hyderabad
    Posts
    252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, That is working fine.
    Able to get the session information on the other page also. Just a small mistake. Thank you for your reply.

  5. #5
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try memcached

  6. #6
    SitePoint Addict ArunB's Avatar
    Join Date
    Jun 2008
    Location
    Hyderabad
    Posts
    252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ?
    It is already working...

    Have a small doubt...

    Is there any difference in using memcache as the session handler and using the Memcache class for caching?

  7. #7
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes.

    With the memcache class you'll have to implement your own versions of functionality already provided by the session functions.

    With the memcache session save handler you can continue to use sessions as usual and the storage using memcached is handled transparently in the background.

  8. #8
    SitePoint Addict ArunB's Avatar
    Join Date
    Jun 2008
    Location
    Hyderabad
    Posts
    252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Which one is better?

    Probably the second one?

  9. #9
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Depends on the application and the data being stored.

    Remember that when using sessions, you'll be storing user-specific copies of data for every visitor.

    Taking that into consideration, you would store user-specific things using sessions, and things which will be the same for all, or groups of visitors, using the memcache class.

    It wouldn't make sense to store say, a latest posts pull from a forum database, in a session. It would however, make sense to store user preferences in the session.


Bookmarks

Posting Permissions

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