Redisの同時テストの安全性テストコード

パッケージcom.jd.ng.shiro.controller。

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

/ **
* @Author:husToy.Wang
* @Date:2019年7月1日9時07分
* @Version 1.0
* /
@RestController
@RequestMapping(値= "/ Redisの/情報")
パブリッククラスRedissionController {

@Autowired
プライベートRedisTemplate redisTemplate;

最終的な静的ロガーロガー=プライベートLoggerFactory.getLogger(RedissionController.class);


/ **
*圧力測定Redisのためにセキュリティを設定
* /
@GetMapping
ます。public void setMessage(){

。= K redisTemplate.opsForValueオブジェクト()( "K" GET );

試み{

IF(K == NULL){

redisTemplate.opsForValue()SET( "K" ,. 1)。
//logger.info("xxxxxxxx「);
}他{
INT = B(INT)K;
redisTemplate 。.opsForValue()SET( "K"、B + 1);
のSystem.out.println(K);
}

}キャッチ(例外E){
logger.error(「例外処理.......... .... {}」、E。getMessage())。
}





}











}

おすすめ

転載: www.cnblogs.com/leigepython/p/11112731.html