先来解决start.bat闪退问题,直接在cmd运行redis-server.exe redis.windows.conf就可以了,虽然有点麻烦,然后加个pause也是可以的
pip install redis -i https://pypi.tuna.tsinghua.edu.cn/simple some-package下载安装redis-py模块
创建链接:
import redis r = redis.Redis( host = "localhost", port = 6379, password = "123456", db = 0 )
创建连接池:
import redis pool = redis。ConnectionPool{ host = "localhost", port = 6379, password = "123456", db = 0 max_connections = 20 )
获取链接,不必关闭,回收时链接会自动归还到链接池
r = redis.Redis( connection_ppol = pool ) ...... del r
redis-py模块用pipline(管道)的方式向redis服务器传递批处理命令和执行事务
pipline = con.pipline()
pipline.watch(...)
pipline.multi()
pipline.execute()
pipline.reset()//这个函数用来释放pipline
Repetition is the mother of all learning重复是学习之母。等到长大,学知识,技巧、爱情、事业、交流....倘若懂得行动的力量,不怕重复,不怕犯错误,那就大有希望靠近幸福了。