1、先完成一个简单的set/get操作
package com.example.HnadleTaskQueue; import redis.clients.jedis.Jedis; import java.util.ArrayList; import java.util.List; public class Handler { public static void main(String[] args) throws InterruptedException { Jedis jedis = jedis = new Jedis("localhost"); List<String> keys = new ArrayList<String>(); keys.add("name"); keys.add("age"); List<String> values = new ArrayList<String>(); values.add("jane"); values.add("); Object result = jedis.eval("return redis.call('mset', KEYS[1], ARGV[1], KEYS[2], ARGV[2])", keys, values); System.out.println(result); values.clear(); Object getResult = jedis.eval("return redis.call('mget', KEYS[1], KEYS[2])", keys, values); List<String> retList = (List<String>) getResult; for (String ret : retList) { System.out.println(ret); } } }