package com.wbg.springRedis.test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;
public class TestCal {
static RedisTemplate redisTemplate = null;
public static void main(String[] args) {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-redis.xml");
redisTemplate = applicationContext.getBean(RedisTemplate.class);
//设值
redisTemplate.opsForValue().set("i", "10");
print();
//加1
redisTemplate.getConnectionFactory().getConnection().incr(
redisTemplate.getKeySerializer().serialize("i")
);
//加4
redisTemplate.getConnectionFactory().getConnection().incrBy(
redisTemplate.