当前位置:网站首页>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(), ";");
边栏推荐
- Detailed explanation of 'viewpager' in compose | developer said · dtalk
- 流媒体技术优化
- What can I do after buying a domain name?
- Eight honors and eight disgraces of the programmer version~
- Go basic constant definition and use
- Warning: implicitly declaring library function 'printf' with type 'int (const char *,...)‘
- MySQL Foundation
- 【ML】李宏毅三:梯度下降&分类(高斯分布)
- Where is the win11 microphone test? Win11 method of testing microphone
- Connexion à distance de la tarte aux framboises en mode visionneur VNC
猜你喜欢

Use redis to realize self increment serial number

CDN 加速,需要域名先备案

Intranet penetration | teach you how to conduct intranet penetration hand in hand

基于Pyqt5工具栏按钮可实现界面切换-2

JDBC practice cases

How much do you know about synchronized?

Solution: exceptiole 'xxxxx QRTZ_ Locks' doesn't exist and MySQL's my CNF file append lower_ case_ table_ Error message after names startup

Three solutions to frequent sticking and no response of explorer in win11 system

Load balancing cluster (LBC)

第三方支付功能测试点【杭州多测师_王sir】【杭州多测师】
随机推荐
万物并作,吾以观复|OceanBase 政企行业实践
Print out mode of go
Markdown basic grammar
Mapper agent development
Eight bit responder [51 single chip microcomputer]
跨境电商如何通过打好数据底座,实现低成本稳步增长
How much do you know about synchronized?
基于FPGA的VGA协议实现
Leetcode relaxation question - day of the week
【OJ】两个数组的交集(set、哈希映射 ...)
A single element in an ordered array -- Valentine's Day mental problems
富滇银行完成数字化升级|OceanBase数据库助力布局分布式架构中台
CDN 加速,需要域名先备案
Load balancing cluster (LBC)
Hisilicon VI access video process
Boost库链接错误解决方案
leetcode 650. 2 keys keyboard with only two keys (medium)
Mapper代理开发
Detailed explanation of 'viewpager' in compose | developer said · dtalk
Master the development of facial expression recognition based on deep learning (based on paddlepaddle)