Example usage for org.springframework.data.redis.core RedisTemplate exec

List of usage examples for org.springframework.data.redis.core RedisTemplate exec

Introduction

In this page you can find the example usage for org.springframework.data.redis.core RedisTemplate exec.

Prototype

@Override
public List<Object> exec() 

Source Link

Document

Execute a transaction, using the default RedisSerializer s to deserialize any results that are byte[]s or Collections or Maps of byte[]s or Tuples.

Usage

From source file:org.shareok.data.redis.UserDaoImpl.java

@Transactional
public void test2() {
    RedisTemplate<String, Object> redis = new RedisTemplate<>();
    redis.setConnectionFactory(connectionFactory);
    //        redis.setKeySerializer(ApplicationConfig.StringSerializer.INSTANCE);
    //        redis.setValueSerializer(new JacksonJsonRedisSerializer<User>(UserDaoImpl.class));
    redis.afterPropertiesSet();// w w  w  .  ja v  a2 s.  c  o m
    redis.setEnableTransactionSupport(true);//???redistemplate?
    redis.multi();
    redis.boundValueOps("somevkey").increment(1);
    redis.boundZSetOps("somezkey").add("zvalue", 11);
    redis.exec();
    redis.setEnableTransactionSupport(false);
}