redis concurrent test safety test code

package com.jd.ng.shiro.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @Author: husToy.Wang
* @Date: 2019/7/1 9:07
* @Version 1.0
*/
@RestController
@RequestMapping(value = "/redis/info")
public class RedissionController {

@Autowired
private RedisTemplate redisTemplate;

Final static Logger Logger = Private LoggerFactory.getLogger (RedissionController.class);


/ **
* Set the Security for pressure-measurement redis
* /
@GetMapping
public void the setMessage () {

. = K redisTemplate.opsForValue Object () GET ( "K" );

the try {

IF (K == null) {

. redisTemplate.opsForValue () SET ( "K",. 1);
//logger.info("xxxxxxxx ");
} the else {
int = B (int) K;
redisTemplate . .opsForValue () SET ( "K", B +. 1);
System.out.println (K);
}

} the catch (exception E) {
logger.error ( "exception processing .......... .... {} ", e.getMessage());
}





}











}

Guess you like

Origin www.cnblogs.com/leigepython/p/11112731.html