Get Started with Redis and Groovy with JRedis
- Once you got Redis up and running you need to grab a copy of JRedis.
- Using GroovyConsole, run this command to include the JRedis jar: "grailsConsole -cp jredis-core-all.jar"
- Execute this sample code:
import org.jredis.*
import org.jredis.ri.alphazero.*
import org.jredis.ri.alphazero.support.*
def redis = new JRedisClient();
redis.set("test", "Hello world")
def result = redis.get("test")
assert DefaultCodec.toStr( redis.get("test") ) == "Hello world"