$redis=new \Redis();
$redis->connect("127.0.0.1",6379);// 6379 端口 connect脚本结束之后连接释放
$redis->setex("key",86000,$cates); // key 设置值及其过期时间
#读取
$redis =new \Redis();
$redis->connect("127.0.0.1",6379);
$temp=$redis->get("key");//获取指定 key 的值
if ($redis->ping() !="+PONG"){
//判断服务器端 是否正常运作
exit('系统错误redis');
};
简单使用 Redis 缓存
最新推荐文章于 2020-11-04 16:33:12 发布