Today I am doing a session test of Memcache, but in the process of testing, I found that Memcache does not have a relatively simple way to directly list all session keys like redis *, and according to the session content corresponding to key get, I started to look up the information, and most of the things that came out were some common memcache commands, etc., but there was not much explanation of the method of listing keys. So I came to Google and found a foreign information
I applied the specific content to my test environment, and the operation is as follows 1. cmd log in to Memcache
2. Make a list of all keys
- stats items // 这条是命令
- STAT items:7:number 1
- STAT items:7:age 188
- END
Copy code 3. Get the key through itemid Next, based on the listed items ID, in this case it is 7, the second parameter is the length listed, and 0 is all listed
- stats cachedump 7 0 // 这条是命令
- ITEM Sess_sidsvpc1473t1np08qnkvhf6j2 [183 b; 1394527347 s]
- END
Copy code
4. Get the key value by get The above stats cachedump command lists my session key, and then use the get command to find the corresponding session value
- get Sess_sidsvpc1473t1np08qnkvhf6j2 //这条是命令
- VALUE
- Sess_sidsvpc1473t1np08qnkvhf6j2 1440 1
- 83
- Sess_|a:5:{s:6:"verify";s:32:"e70981fd305170c41a5632b2a24bbcaa";s:3:"uid";s:1:"1
- ";s:8:"username";s:5:"admin";s:9:"logintime";s:19:"2014-03-11 16:24:25";s:7:"log
- inip";s:9:"127.0.0.1";}
Copy code
|