Closed startjava closed 2 years ago
package com.ghy.www.test9;
import com.ghy.www.f.F; import io.rebloom.client.Client; import io.rebloom.client.ReserveParams; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig;
import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set;
public class Bloom_6 { private static JedisPool pool = new JedisPool(new JedisPoolConfig(), F.IP_1, F.PORT_1, F.TIMEOUT_1, F.PASSWORD_1);
public static void main(String[] args) { Jedis jedis = null; Client client = null; try { jedis = pool.getResource(); jedis.flushDB(); client = new Client(pool); ReserveParams params = new ReserveParams(); client.bfReserve("mykey", 0.001, 10, params); client.add("mykey", "a"); client.add("mykey", "b"); client.add("mykey", "c"); client.add("mykey", "d"); client.add("mykey", "e"); Map backupMap = new HashMap(); Map.Entry<Long, byte[]> mykey = client.cfScanDump("mykey", 0); while (mykey.getKey() != 0) { long cursor = mykey.getKey(); byte[] dataArray = mykey.getValue(); backupMap.put(cursor, dataArray); mykey = client.cfScanDump("mykey", cursor); } jedis.flushDB(); Set<Map.Entry> set = backupMap.entrySet(); Iterator<Map.Entry> iterator = set.iterator(); while (iterator.hasNext()) { client.cfLoadChunk("mykey", iterator.next()); } System.out.println(); Map<String, Object> mykeyInfo = client.info("mykey"); for (String eachKey : mykeyInfo.keySet()) { System.out.println("key=" + eachKey + " value=" + mykeyInfo.get(eachKey)); } } catch (Exception e) { e.printStackTrace(); } finally { if (jedis != null) { jedis.close(); } if (client != null) { client.close(); } } }
}
redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of value
about cf data type . no bf data type.
package com.ghy.www.test9;
import com.ghy.www.f.F; import io.rebloom.client.Client; import io.rebloom.client.ReserveParams; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig;
import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set;
public class Bloom_6 { private static JedisPool pool = new JedisPool(new JedisPoolConfig(), F.IP_1, F.PORT_1, F.TIMEOUT_1, F.PASSWORD_1);
}
redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of value