Home  >  Article  >  Backend Development  >  session cookie memcache分别怎么用?有什么区别?

session cookie memcache分别怎么用?有什么区别?

WBOY
WBOYOriginal
2016-06-23 14:09:08909browse

php初学者,session cookie memcache分别怎么用?一般在什么情况下使用?有什么区别?请各位牛人帮忙解答,谢谢


回复讨论(解决方案)

memcached是高性能的分布式内存缓存服务器。一般的使用目的是,通过缓存数据库查询结果,减少数据库访问次数,以提高动态web应用的速度、提高扩展性。
其特点
1、协议简单
2、基于libevent的事件处理
3、内置内存存储方式
4、memcached不互相通信的分布式

Session 的作用就是它在 Web服务器上保持用户的状态信息供在任何时间从任何页访问,Session信息存储在服务器

Cookie 可以保持登录信息到用户下次与服务器的会话.Cookie信息存储在本地

Session 和 Cookie 用于保存访问者的私有数据,前者保存在服务器上,后者保存在浏览器中
memcached 用于保存公有的数据(变量和对象),可以在不同的程序实例间交换数据

memcache可以作为数据缓存
http://hi.baidu.com/fdwm_lx/item/e314ebf72e901cdc6225d2d1

简单一点说:
session是保存在服务器中。
cookie是保存在客户端中。

session比cookie更安全。
cookie不占系统资源。
 memcache本人也再研究。

你只要知道 cookie 是保存在客户端,且保存数据小,大约4KB左右。
Session是保存在服务器端,大小基本来说没有限制。

http://blog.chinaunix.net/uid-20778583-id-301990.html

本人比较愚钝,这篇文章没有看懂。
大家给分析分析

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn