Created
March 24, 2013 22:11
-
-
Save arthurtsang/5233783 to your computer and use it in GitHub Desktop.
calling redis script using Redis Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template.execute(new RedisCallback<Object>() { | |
@Override | |
public Object doInRedis(RedisConnection connection) throws DataAccessException { | |
Jedis jedis = (Jedis) connection.getNativeConnection(); | |
RedisSerializer<Object> redisSerializer = (RedisSerializer<Object>) template.getHashValueSerializer(); | |
String json = new String( redisSerializer.serialize(value) ); | |
return jedis.eval(UPDATE_OHASH_SCRIPT, 2, listKey, hashKey, id, json); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment