phpredis 可以用来存储php的session
2014-03-15 18:54
585 查看
redis的官方github这么说:
phpredis can be used to store PHP sessions. To do this, configure session.save_handler and session.save_path in your php.ini to tell phpredis where to store the sessions:
来自:https://github.com/nicolasff/phpredis#php-session-handler
确实是个不错方法
phpredis can be used to store PHP sessions. To do this, configure session.save_handler and session.save_path in your php.ini to tell phpredis where to store the sessions:
session.save_handler = redis
session.save_path = "tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&timeout=2.5, tcp://host3:6379?weight=2"
session.save_path can have a simple host:port format too, but you need to provide the tcp:// scheme if you want to use the parameters. The following parameters are available:
weight (integer): the weight of a host is used in comparison with the others in order to customize the session distribution on several hosts. If host A has twice the weight of host B, it will get twice the amount of sessions. In the example, host1 stores 20%
of all the sessions (1/(1+2+2)) while host2 and host3 each store 40% (2/1+2+2). The target host is determined once and for all at the start of the session, and doesn't change. The default weight is 1.
timeout (float): the connection timeout to a redis host, expressed in seconds. If the host is unreachable in that amount of time, the session storage will be unavailable for the client. The default timeout is very high (86400 seconds).
persistent (integer, should be 1 or 0): defines if a persistent connection should be used. (experimental setting)
prefix (string, defaults to "PHPREDIS_SESSION:"): used as a prefix to the Redis key in which the session is stored. The key is composed of the prefix followed by the session ID.
auth (string, empty by default): used to authenticate with the server prior to sending commands.
database (integer): selects a different database.
Sessions have a lifetime expressed in seconds and stored in the INI variable "session.gc_maxlifetime". You can change it with ini_set(). The session handler requires a version of Redis with the SETEX command (at least 2.0). phpredis can also connect to a unix
domain socket: session.save_path = "unix:///var/run/redis/redis.sock?persistent=1&weight=1&database=0.
phpredis can be used to store PHP sessions. To do this, configure session.save_handler and session.save_path in your php.ini to tell phpredis where to store the sessions:
来自:https://github.com/nicolasff/phpredis#php-session-handler
确实是个不错方法
phpredis can be used to store PHP sessions. To do this, configure session.save_handler and session.save_path in your php.ini to tell phpredis where to store the sessions:
session.save_handler = redis
session.save_path = "tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&timeout=2.5, tcp://host3:6379?weight=2"
session.save_path can have a simple host:port format too, but you need to provide the tcp:// scheme if you want to use the parameters. The following parameters are available:
weight (integer): the weight of a host is used in comparison with the others in order to customize the session distribution on several hosts. If host A has twice the weight of host B, it will get twice the amount of sessions. In the example, host1 stores 20%
of all the sessions (1/(1+2+2)) while host2 and host3 each store 40% (2/1+2+2). The target host is determined once and for all at the start of the session, and doesn't change. The default weight is 1.
timeout (float): the connection timeout to a redis host, expressed in seconds. If the host is unreachable in that amount of time, the session storage will be unavailable for the client. The default timeout is very high (86400 seconds).
persistent (integer, should be 1 or 0): defines if a persistent connection should be used. (experimental setting)
prefix (string, defaults to "PHPREDIS_SESSION:"): used as a prefix to the Redis key in which the session is stored. The key is composed of the prefix followed by the session ID.
auth (string, empty by default): used to authenticate with the server prior to sending commands.
database (integer): selects a different database.
Sessions have a lifetime expressed in seconds and stored in the INI variable "session.gc_maxlifetime". You can change it with ini_set(). The session handler requires a version of Redis with the SETEX command (at least 2.0). phpredis can also connect to a unix
domain socket: session.save_path = "unix:///var/run/redis/redis.sock?persistent=1&weight=1&database=0.
相关文章推荐
- 配置 PHP 的 Session 存储到 Redis
- 详解PHP使用Redis存储session时的一个Warning定位
- redis 替代php文件存储session
- php实现Session存储到Redis
- PHP实现redis存储session
- PHP中使用Redis存储Session
- 21.16-21.20 redis:操作键值,安全设置,慢查询日志,php模块,存储session
- 对 PHP SESSION 的深刻认识(四)---- 缓存(memcache和redis)存储session
- PHP使用Redis存储session时的一个Warning定位
- PHP中使用memcache(或者redis)存储session
- php实现Session存储到Redis
- php Session存储到Redis的方法
- php Session存储到Redis的方法
- php Redis存储Session
- [PHP]php的sessionid可以伪造,不要用来做防刷新处理了
- php Session存储到Redis的方法
- Redis 之 (3) 慢查询日志、存储session、主从配置、php安装redis扩展
- php Session存储到Redis的方法
- php设置session存储在redis
- php的sessionid可以伪造,不要用来做防刷新处理了!