引用Java redis 驱动,即可连接:
import redis.clients.jedis.Jedis;
public class RedisTestJava
{
public static void main(String[] args)
{
//连接redis 服务
Jedis jedis = new Jedis("localhost");
System.out.println("连接成功");
jedis.set("redisCachedParam", "测试值");
System.out.println( jedis.get("redisCachedParam"));
}
}
UniframeworkRedisDao redisDao = new ServiceLocator().getUniframeworkRedisDao();
redisDao.setValue("redisCachedParam", "测试值");
System.out.println(redisDao.getValue("redisCachedParam"));
UniframeworkRedisDao redisDao = manager.geRedisDao();
redisDao.setValue("redisCachedParam", "测试值");
System.out.println(redisDao.getValue("redisCachedParam"))