当前位置:网站首页>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(), ";");
边栏推荐
- @BindsInstance在Dagger2中怎么使用
- 请求与响应
- Win11麦克风测试在哪里?Win11测试麦克风的方法
- Program analysis and Optimization - 9 appendix XLA buffer assignment
- RuntimeError: no valid convolution algorithms available in CuDNN
- Brief introduction to common sense of Zhongtai
- Third party payment function test point [Hangzhou multi tester _ Wang Sir] [Hangzhou multi tester]
- [proteus simulation] 51 MCU +lcd12864 push box game
- [OJ] intersection of two arrays (set, hash mapping...)
- 【Proteus仿真】51单片机+LCD12864推箱子游戏
猜你喜欢
随机推荐
SharedPreferences 保存List<Bean> 到本地并解决com.google.gson.internal.LinkedTreeMap cannot be cast to异常
Convolution和Batch normalization的融合
Implementation of VGA protocol based on FPGA
2022年最新最全软件测试面试题大全
JDBC教程
How does win11 turn on visual control? Win11 method of turning on visual control
Intranet penetration | teach you how to conduct intranet penetration hand in hand
基于FPGA的VGA协议实现
Integration of revolution and batch normalization
【STL源码剖析】仿函数(待补充)
RuntimeError: no valid convolution algorithms available in CuDNN
(毒刺)利用Pystinger Socks4上线不出网主机
I've been interviewed. The starting salary is 16K
Which common ports should the server open
What experience is there only one test in the company? Listen to what they say
sourcetree 详细
Optimization of streaming media technology
JSON数据传递参数
Highly available cluster (HAC)
Eight bit responder [51 single chip microcomputer]








