当前位置:网站首页>Django--20实现Redis支持、上下文以及上下文和接口的交互
Django--20实现Redis支持、上下文以及上下文和接口的交互
2022-08-11 05:13:00 【不 再 熬 夜】
一、业务场景分析
1.待测系统
典型的前后端分离系统
yshop电商后台
2.登录场景
1、获取验证码问题和uuid
接口:/auth/code
目的:获取UUID作为获取验证码答案的redis key
redis:Not Only SQL
2、获取验证码答案(redis)
接口:redis
目的:获取验证码答案,传递给登录接口
3、调用登录接口
接口:/auth/login
目的:获取认证令牌(Bearer Token),为后续的所有需要验证的接口所用
4、获取用户接口列表
接口:/api/users
目的:验证令牌有效
插曲:mysql和redis比较
二、实现思路分析
1、必须能调用redis
2、必须能在前后接口之间维护Context上下文
思考:上下文存储在哪里?是标量?字典?还是列表?
3、必须能将接口执行结果保存到上下文
4、必须能从上下文获取数据作为接口运行时参数
Request Header
Request Body
Query Parameters
redis key
三、落地步骤梳理
1.实现redis支持(实现mysql支持)
事前准备:
1、安装redis
pip install red
边栏推荐
- 关于ie下href有中文出现RFC 7230 and RFC 3986问题的研究
- BitLocker的解密
- Keras与tensorflow 使用基础
- Weekly recommended short video: your commonly used Polaroid, its predecessor turned out to be like this!
- K8s复习笔记7--Redis单机和Redis-cluster的K8S实现
- 元宇宙社交应用,靠什么吸引用户「为爱发电」?
- 【嵌入式开源库】cJSON的使用,高效精简的json解析库
- Redis中RDB和AOF的区别
- 3 Module 2: Use of scientific research tools
- IDEA使用记录
猜你喜欢

【嵌入式开源库】cJSON的使用,高效精简的json解析库

Configure checkstyle in IDEA

用白嫖的Adobe正版软件,减少应届毕业生的慢就业、不就业等现象

Prometheus :(一)基本概念

分库分表之sharding-proxy

Switch and Router Technology - 22/23 - OSPF Dynamic Routing Protocol/Link State Synchronization Process

ARM结构体系4:嵌入式硬件平台接口开发

Zabbix builds enterprise-level monitoring and alarm platform

【动态代理】CGLIB 动态代理的使用及原理

【嵌入式开源库】MultiButton的使用,简单易用的事件驱动型按键驱动模块
随机推荐
[FPGA tutorial case 49] Control case 1 - FPGA-based PID controller verilog implementation
一些常见mysql入门练习
Development Tools Lecture 7: Alibaba Cloud Log Query and Analysis
[Embedded open source library] The use of cJSON, an efficient and streamlined json parsing library
2.2 user manual] [QNX Hypervisor 10.15 vdev timer8254
将double类型的数据转为字符串
In the closing pages/uninstall (unload) sends a request to the server before the document
Switch and Router Technology - 28 - NSSA Areas for OSPF
Difference between @Resource and @Autowired
You must understand - the nine built-in objects and four domain objects of JSP
【动态代理】CGLIB 动态代理的使用及原理
Zabbix builds enterprise-level monitoring and alarm platform
【无标题】2022年胺基化工艺考试题模拟考试题库及在线模拟考试
Application layer protocol - DNS
pytorch基础之 pytorch 模型开发模板
批量修改数据库等视频文件名称
【Cron】学习:cron 表达式
面试宝典一: code题目记录
Mysql introductory exercise
Paper Notes: Bag of Tricks for Long-Tailed Visual Recognition with Deep Convolutional Neural Networks