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

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

Introduction

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

Prototype

@Nullable
<T> T eval(byte[] script, ReturnType returnType, int numKeys, byte[]... keysAndArgs);

Source Link

Document

Evaluate given script .

Usage

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

/**
 * Evaluate given {@code script}.//  ww w. ja v  a  2  s .  co  m
 * <p>
 * See http://redis.io/commands/eval
 * 
 * @param <T> t
 * @param script script
 * @param returnType returnType
 * @param numKeys numKeys
 * @param keysAndArgs keysAndArgs
 * @return T
 */
public static <T> T eval(byte[] script, ReturnType returnType, int numKeys, byte[]... keysAndArgs) {
    return redisTemplate.execute(new RedisCallback<T>() {
        @Override
        public T doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.eval(script, returnType, numKeys, keysAndArgs);
        }
    });
}

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

/**
 * Evaluate given {@code script}.//from  w ww  . jav a2  s  .c  om
 * <p>
 * See http://redis.io/commands/eval
 * 
 * @param <T> t
 * @param script script
 * @param returnType returnType
 * @param numKeys numKeys
 * @param keysAndArgs keysAndArgs
 * @return T
 */
public <T> T eval(byte[] script, ReturnType returnType, int numKeys, byte[]... keysAndArgs) {
    return redisTemplate.execute(new RedisCallback<T>() {
        @Override
        public T doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.eval(script, returnType, numKeys, keysAndArgs);
        }
    });
}