当前位置:网站首页>Develop knowledge points
Develop knowledge points
2022-07-02 23:42:00 【Catch clues】
//TODO 5、 Anti duplication token ( Prevent forms from being submitted repeatedly )
// Set a for the user token, Thirty minute expiration time ( There is redis)
String token = UUID.randomUUID().toString().replace("-", "");
redisTemplate.opsForValue().set(USER_ORDER_TOKEN_PREFIX+memberResponseVo.getId(),token,30, TimeUnit.MINUTES);
confirmVo.setOrderToken(token);
Generate uuid As redis Of key
redis The script determines whether the data passed from the front end is consistent with the back end
//1、 Verify that the token is legal 【 The comparison and deletion of tokens must ensure atomicity 】
String script = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end";
String orderToken = vo.getOrderToken();
// adopt lure Script atomic authentication token and delete token
Long result = redisTemplate.execute(new DefaultRedisScript<Long>(script, Long.class),
Arrays.asList(USER_ORDER_TOKEN_PREFIX + memberResponseVo.getId()),
orderToken);
Set to string
// Use StringUtils.collectionToDelimitedString take list Set to String
String skuAttrValues = StringUtils.collectionToDelimitedString(items.getSkuAttrValues(), ";");
边栏推荐
- [proteus simulation] 51 MCU +lcd12864 push box game
- leetcode 650. 2 Keys Keyboard 只有两个键的键盘(中等)
- Where is the win11 microphone test? Win11 method of testing microphone
- Submit code process
- 购买完域名之后能干什么事儿?
- 采用VNC Viewer方式遠程連接樹莓派
- 数据集-故障诊断:西储大学轴承的各项数据以及数据说明
- vim区间删行注释
- Bean load control
- CADD课程学习(4)-- 获取没有晶体结构的蛋白(SWISS-Model)
猜你喜欢
解决:exceptiole ‘xxxxx.QRTZ_LOCKS‘ doesn‘t exist以及mysql的my.cnf文件追加lower_case_table_names后启动报错
What can I do after buying a domain name?
JDBC Exercise case
How much do you know about synchronized?
[Verilog tutorial]
Markdown basic grammar
第三方支付功能测试点【杭州多测师_王sir】【杭州多测师】
Mapper代理开发
[live broadcast appointment] database obcp certification comprehensive upgrade open class
Win11启用粘滞键关闭不了怎么办?粘滞键取消了但不管用怎么解决
随机推荐
Win11启用粘滞键关闭不了怎么办?粘滞键取消了但不管用怎么解决
Implementation of VGA protocol based on FPGA
数据集-故障诊断:西储大学轴承的各项数据以及数据说明
Three solutions to frequent sticking and no response of explorer in win11 system
All things work together, and I will review oceanbase's practice in government and enterprise industry
How to set automatic reply for mailbox and enterprise mailbox?
The concepts of terminal voltage, phase voltage and line voltage in FOC vector control and BLDC control are still unclear
Master the development of facial expression recognition based on deep learning (based on paddlepaddle)
JDBC Exercise case
Arduino - character judgment function
Why can't the start method be called repeatedly? But the run method can?
Eight honors and eight disgraces of the programmer version~
Use redis to realize self increment serial number
返回二叉树两个节点间的最大距离
流媒体技术优化
顶级 DevOps 工具链大盘点
Fusion de la conversion et de la normalisation des lots
Connexion à distance de la tarte aux framboises en mode visionneur VNC
Arduino - 字符判断函数
【直播预约】数据库OBCP认证全面升级公开课