Example usage for org.springframework.data.redis.connection RedisConnection watch

List of usage examples for org.springframework.data.redis.connection RedisConnection watch

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection RedisConnection watch.

Prototype

void watch(byte[]... keys);

Source Link

Document

Watch given keys for modifications during transaction started with #multi() .

Usage

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Watch given {@code keys} for modifications during transaction started with {@link #multi()}.
 * <p>//  ww  w .j  a v a2 s  .co m
 * See http://redis.io/commands/watch
 * 
 * @param keys keys
 */
public static void watch(byte[]... keys) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.watch(keys);
            return null;
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Watch given {@code keys} for modifications during transaction started with {@link #multi()}.
 * <p>/* ww  w .j  a va  2s . c om*/
 * See http://redis.io/commands/watch
 * 
 * @param keys keys
 */
public void watch(byte[]... keys) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.watch(keys);
            return null;
        }
    });
}