1.安装 pip install django_redis
2.导包 from django_redisimport get_redis_connection
3.存储
redis_conn = get_redis_connection('verify_code')
格式化输出保存键,字符utf8,300秒过期时间,值
redis_conn.setex('img_{}'.format(img_id).encode('utf8'),300,text)
1.安装 pip install django_redis
2.导包 from django_redisimport get_redis_connection
3.存储
redis_conn = get_redis_connection('verify_code')
格式化输出保存键,字符utf8,300秒过期时间,值
redis_conn.setex('img_{}'.format(img_id).encode('utf8'),300,text)
本文标题:django_redis
本文链接:https://www.haomeiwen.com/subject/cinejhtx.html
网友评论