当前位置: 首页 > 工具软件 > JRedis > 使用案例 >

java mset_调用java jredis mset方法异常

郭知
2023-12-01

运行代码片段:

/**

* Using the synchronous interface

*/

public static void usingSyncClient () {

ConnectionSpec spec = DefaultConnectionSpec.newSpec("192.168.68.110",6666,0,null)

.setCredentials("mypass".getBytes())

.setDatabase(10);

JRedis jredis = new JRedisClient(spec);

System.out.println ("\nusing the SyncClient: \n\n");

try {

Strings kvSet = BulkSetMapping.newStringKVSet();

kvSet

.add("foo", "woof")

.add("bar", "meow")

.add("paz", "thesalt");

// mappings.add("ewe", "dwe");

jredis.mset(kvSet);

} catch (RedisException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

//useMSet (jredis);

// useMSetNX (jredis);

jredis.quit();

}

** 异常信息:

01447661803808 Mon Nov 16 16:16:43 CST 2015 JRedis[tid:10] : WARNING: heartbeat is disabled.

01447661803831 Mon Nov 16 16:16:43 CST 2015 JRedis[tid:10] : Error response for MSET => ERR Protocol error: expected '$', got '*'

Exception on [MSET] => ERR Protocol error: expected '$', got '*'

at org.jredis.ri.alphazero.connection.SyncConnection.serviceRequest(SyncConnection.java:156)

at org.jredis.ri.alphazero.JRedisClient.serviceRequest(JRedisClient.java:151)

at org.jredis.ri.alphazero.JRedisSupport.mset(JRedisSupport.java:1140)

at org.jredis.ri.alphazero.JRedisSupport.mset(JRedisSupport.java:1156)

at org.jredis.examples.commands.UsingBulkCommands.usingSyncClient(UsingBulkCommands.java:119)

at org.jredis.examples.commands.UsingBulkCommands.main(UsingBulkCommands.java:48)

 类似资料: