当前位置:网站首页>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(), ";");
边栏推荐
- 跨境电商如何通过打好数据底座,实现低成本稳步增长
- Load balancing cluster (LBC)
- MySQL基础
- Win11系统explorer频繁卡死无响应的三种解决方法
- Compose 中的 'ViewPager' 详解 | 开发者说·DTalk
- @BindsInstance在Dagger2中怎么使用
- Where is the win11 automatic shutdown setting? Two methods of setting automatic shutdown in win11
- The difference between new and make in golang
- Convolution和Batch normalization的融合
- Integration of revolution and batch normalization
猜你喜欢

RuntimeError: no valid convolution algorithms available in CuDNN

“一个优秀程序员可抵五个普通程序员!”

Speech recognition Series 1: speech recognition overview

JDBC練習案例

Eight honors and eight disgraces of the programmer version~

LINQ usage collection in C #

Implementation of VGA protocol based on FPGA

JDBC Exercise case

第三方支付功能测试点【杭州多测师_王sir】【杭州多测师】

Win11系统explorer频繁卡死无响应的三种解决方法
随机推荐
Tiktok actual combat ~ number of likes pop-up box
Go project operation method
Data set - fault diagnosis: various data and data description of bearings of Western Reserve University
基于FPGA的VGA协议实现
[OJ] intersection of two arrays (set, hash mapping...)
What is the official website address of e-mail? Explanation of the login entry of the official website address of enterprise e-mail
Dishes launcher small green program and directory management (efficiency tool)
@BindsInstance在Dagger2中怎么使用
Win11启用粘滞键关闭不了怎么办?粘滞键取消了但不管用怎么解决
How difficult is it to be high? AI rolls into the mathematics circle, and the accuracy rate of advanced mathematics examination is 81%!
Highly available cluster (HAC)
How much do you know about synchronized?
第三方支付功能测试点【杭州多测师_王sir】【杭州多测师】
Flexible combination of applications is a false proposition that has existed for 40 years
Wechat applet basic learning (wxss)
VIM interval deletion note
请求与响应
【OJ】两个数组的交集(set、哈希映射 ...)
非路由组件之头部组件和底部组件书写
JDBC practice cases