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

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

Introduction

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

Prototype

@Nullable
String scriptLoad(byte[] script);

Source Link

Document

Load lua script into scripts cache, without executing it.
Execute the script by calling #evalSha(byte[], ReturnType, int, byte[]...) .

Usage

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

/**
 * Load lua script into scripts cache, without executing it.<br>
 * Execute the script by calling {@link #evalSha(String, ReturnType, int, byte[])}.
 * <p>//  ww  w. jav  a  2s.  c  om
 * See http://redis.io/commands/script-load
 * 
 * @param script script
 * @return String
 */
public static String scriptLoad(byte[] script) {
    return redisTemplate.execute(new RedisCallback<String>() {
        @Override
        public String doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.scriptLoad(script);
        }
    });
}

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

/**
 * Load lua script into scripts cache, without executing it.<br>
 * Execute the script by calling {@link #evalSha(String, ReturnType, int, byte[])}.
 * <p>/* ww  w. j  a  v  a2 s.c o m*/
 * See http://redis.io/commands/script-load
 * 
 * @param script script
 * @return String
 */
public String scriptLoad(byte[] script) {
    return redisTemplate.execute(new RedisCallback<String>() {
        @Override
        public String doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.scriptLoad(script);
        }
    });
}