Memcache get key method, query session Store

Source: Internet
Author: User

The headline may be a bit out of line with my article.

When I first approached Memcache, I thought:

Set the load balance when the session of the storage can be used memcache, so search the relevant information.

First, modify the following two configurations of PHP.ini

Session.save_handler = memcached
Session.save_path = "127.0.0.1:11211"

Restart Service PHP-FPM Restart

Then write a php file to store the next session to try

session.php

<?php

Session_Start ();

$_session[' username '] = ' honghong ';

This time back to the black box to see the memcache in the Sesiion

There's been some trouble here too ^ ^

Telnet 127.0.0.1 11211

I wanted to get straight, but it didn't work.

And then you think

Stats items//list memcache all keys

STAT Items:3:number 1
STAT Items:3:age 160
STAT items:3:evicted 0
STAT Items:3:evicted_nonzero 0
STAT Items:3:evicted_time 0
STAT Items:3:outofmemory 0
STAT Items:3:tailrepairs 0
STAT items:3:reclaimed 0
STAT items:3:expired_unfetched 0
STAT items:3:evicted_unfetched 0
STAT items:3:crawler_reclaimed 0
STAT items:3:crawler_items_checked 0
STAT items:3:lrutail_reflocked 0
STAT Items:7:number 1
STAT items:7:age 1350
STAT items:7:evicted 0

Then run the command

Stats cachedump 3 0//Enquiry 3 All information

Result ITEM Memc.sess.cqcmk19vs5fgp4um5976lj7cj0 [B; 1491547440 S]

This is the session. ^ ^

When you run the command

Get Memc.sess.cqcmk19vs5fgp4um5976lj7cj0

Results user|s:8: "Honghong"; The session is stored in the memcache to obtain

Memcache get key method, query session Store

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.