当前位置:网站首页>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(), ";");
边栏推荐
- “一个优秀程序员可抵五个普通程序员!”
- C MVC creates a view to get rid of the influence of layout
- 67页新型智慧城市整体规划建设方案(附下载)
- Pandora IOT development board learning (HAL Library) - Experiment 4 serial port communication experiment (learning notes)
- Simple square wave generating circuit [51 single chip microcomputer and 8253a]
- How difficult is it to be high? AI rolls into the mathematics circle, and the accuracy rate of advanced mathematics examination is 81%!
- SharedPreferences 保存List<Bean> 到本地并解决com.google.gson.internal.LinkedTreeMap cannot be cast to异常
- Win11系统explorer频繁卡死无响应的三种解决方法
- The use of 8255 interface chip and ADC0809
- Mapper代理开发
猜你喜欢
Win11启用粘滞键关闭不了怎么办?粘滞键取消了但不管用怎么解决
Convolution和Batch normalization的融合
How to set automatic reply for mailbox and enterprise mailbox?
RuntimeError: no valid convolution algorithms available in CuDNN
JDBC教程
一文掌握基于深度学习的人脸表情识别开发(基于PaddlePaddle)
Go basic data type
(毒刺)利用Pystinger Socks4上线不出网主机
Win11系统explorer频繁卡死无响应的三种解决方法
PR FAQ, what about PR preview video card?
随机推荐
Go basic data type
Intranet penetration | teach you how to conduct intranet penetration hand in hand
MySQL基础
Bean load control
解决:exceptiole ‘xxxxx.QRTZ_LOCKS‘ doesn‘t exist以及mysql的my.cnf文件追加lower_case_table_names后启动报错
Three solutions to frequent sticking and no response of explorer in win11 system
Fudian bank completes the digital upgrade | oceanbase database helps to layout the distributed architecture of the middle office
How does win11 turn on visual control? Win11 method of turning on visual control
A single element in an ordered array -- Valentine's Day mental problems
RuntimeError: no valid convolution algorithms available in CuDNN
2022 latest and complete interview questions for software testing
Arduino - 字符判断函数
【ML】李宏毅三:梯度下降&分类(高斯分布)
Yolox enhanced feature extraction network panet analysis
The difference between new and make in golang
Golang common settings - modify background
Go basic constant definition and use
vim区间删行注释
Markdown basic grammar
67页新型智慧城市整体规划建设方案(附下载)