The speed at which the session is stored or taken (the access difference is small):
Code:
for ($i =0; $i < $i + +) {
$BB = self::get_session (' testsession ');
}
Memcache (Access difference is not small):
Code:
$a = ' asdflajsdfoijaf203rfjd09wqe4tj0ahgfiopsadifgh '. Mt_rand (1000,9999);
$mem = new Zz_memcache ();
for ($i =0; $i < $i + +) {
$AA = $mem->get (' aaa ');
}
Cookies:
Code
for ($i =0; $i < $i + +) {
$a =$_cookie[' aaa '];
}
Conclusion: Cookies are significantly slower than sessions and Memcach, session and Memcach cannot be compared and continue to be tested with code without AB
Memcache Code:
Echo Xdebug_time_index ();
for ($i =0; $i < 100000; $i + +) {
$AA = $mem->get (' aaa ');
}
Echo ' <br> '. Xdebug_time_index ();
Results:
Session Code:
Echo Xdebug_time_index ();
for ($i =0; $i < 100000; $i + +) {
$BB = self::get_session (' testsession ');
}
Echo ' <br> '. Xdebug_time_index ();
Results:
Conclusion: Take the session incredibly faster than Memcach!!!!!!!!!!!!!!
May be the test method has a problem, this method of testing out to take a cookie is also very fast, even faster than to take the session!!!
Just believe the AB test conclusion,
AB test Memcache,redis,session,cookie the respective access speed