花红小黑膏,神墓电视剧演员表,辽宁省公安厅厅长
设置缓存可采用cachedemo中的中间件方法(https://www.cnblogs.com/siplips/p/9618034.html),对客户端浏览器缓存时间进行设定;也可采用下面的装饰器方法,可对单独的东西进行缓存,如:函数
1 caches = { 2 'default': { 3 'backend': 'django.core.cache.backends.filebased.filebasedcache', 4 'location': '/users/ljb/desktop', #缓存到硬盘(此处设置为保存缓存到桌面) 5 } 6 }
1 caches = { #把缓存保存到redis数据库 2 "default": { 3 "backend": "django_redis.cache.rediscache", 4 "location": "redis://127.0.0.1:6379/1", #数字1为redis数据库号, 5 "options": { 6 "client_class": "django_redis.client.defaultclient", 7 "password": "123456" 8 } 9 } 10 }
注:select 1 切换redis库 keys * 查看所有数据 auth 123456 密码登录
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Python 实现将numpy中的nan和inf,nan替换成对应的均值
python爬虫把url链接编码成gbk2312格式过程解析
网友评论