6、2、2 存到redis 中的验证码

还没有用到rabittmq

    @RequestMapping("/getYZM/{phone}")
    public Object getYZM(@PathVariable String phone){
        if(redisTemplate.hasKey(phone)) {
            redisTemplate.delete(phone);
        }
        String yzm = MessageUtil.creatYZM();
        redisTemplate.opsForValue().set(phone, yzm);
        System.out.println("我获得的缓存是"+redisTemplate.opsForValue().get(phone));
        return yzm;
        
        
    }

猜你喜欢

转载自www.cnblogs.com/zwyzwy/p/11990556.html