Cannot use Jedis when in Multi. Please use JedisTransaction instead.
当在程序中遇到这个异常时,有可能是返回的缓存对象序列化失败。
例子:
@CachePut(value = "emchat", key = "'Emchat:' + #emchatMsg.msgFrom+#emchatMsg.msgDate")
public Emchat[] saveEmchatInRedis(EmchatMsg emchatMsg){
return EmchatUtils.convertEmchatMsgStr(emchatMsg);
}
运行此方法时会报:Cannot use Jedis when in Multi. Please use JedisTransaction instead.
但是换成:
@CachePut(value = "emchat", key = "'Emchat:' + #emchatMsg.msgFrom+#emchatMsg.msgDate",condition="#result != null")
public String saveEmchatInRedis(EmchatMsg emchatMsg){
if(null!=emchatMsg){
return emchatMsg.getMsgContent();
}
return null;
}
就可以运行成功,说明缓存的对象没有进行处理成能缓存的对象(配置里没有支持数组处理)。
配置如下:
<bean id="cacheManager" class="org.springframework.data.redis.cache.RedisCacheManager"
c:template-ref="redisTemplate" p:defaultExpiration="14400"/>
<bean id="jedisConnFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="usePool" value="true"/>
<property name="hostName" value="${redis.host}"/>
<property name="port" value="${redis.port}"/>
<property name="database" value="${redis.database}"/>
</bean>
<bean id="jedisClient" class="redis.clients.jedis.Jedis" c:host="${redis.host}"></bean>
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"
p:connection-factory-ref="jedisConnFactory">
<property name="keySerializer">
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer"></bean>
</property>
<property name="stringSerializer">
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer"></bean>
</property>
<property name="hashKeySerializer">
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer"></bean>
</property>
<property name="hashValueSerializer">
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer"></bean>
</property>
</bean>
<cache:annotation-driven proxy-target-class="false"/>
相关推荐
jedis.auth("192.168akeiekekKKDJEikekEJkeu^&&%%$&#*($#&^$&^#$*((BNGGyjekeuh{}jejekekej:"); ping(jedis); hashBytesSave(jedis); hashBytesGet(jedis); // ListCommandsTest jedis.close();...
redis3.2.1+jedis2.8.0+jedis.api.rar一站下载
jedis-2.0 api.jedis-2.0 api.
jedis-2.4.2版本.rar
jedis-2.8.0.jar 、jedis-2.1.0.jar 资源可靠 edis-2.8.0.jar 、jedis-2.1.0.jar 资源可靠 jedis-2.8.0.jar 、jedis-2.1.0.jar 资源可靠 jedis-2.8.0.jar 、jedis-2.1.0.jar 资源可靠
jedis3.0相关jar包,确认可用。包括:jedis-3.0.0.jar、jedis-3.0.0-javadoc.jar、jedis-3.0.0-sources.jar 3个jar包。
jedis-2.8.0.jar
jedis-2.4.1.jar、redis.clients-3.0.1.jar、jedis-3.0.0.jar 全量包,可用!
最新的redis连接池使用的两个jar包 jJedis3.30 jar,commons-pool2-2.9.0。测试能正常使用
jedis-3.0.jar jedis-3.0.jar jedis-3.0.jar jedis-3.0.jar
Jedis: 一款java操作redis数据库的工具. 使用步骤: 1.导入jedis的jar包 2.使用 jedis连接池: JedisPool 使用步骤: 1.创建JedisPool连接池对象 2.调用方法 getResource()方法获取Jedis连接
Jedis所需要的jar包,包括commons-pool2-2.4.2.jar和jedis-2.8.1.jar
jedis-2.1.0.jar+commons-pool-1.6.jar
jedis-2.9.jar包
java.lang.NoSuchMethodError: redis.clients.jedis.ScanResult.getStringCursor()Ljava/lang/String; at org.crazycake.shiro.WorkAloneRedisManager.keys(WorkAloneRedisManager.java:149) at org.crazycake....
jedis-lock, Jedis分布式锁定支持 jedis锁使用Redis数据库和Jedis驱动程序,Jedis锁易于使用和简单的分布式锁实现。我怎么用它?你可以在以下位置下载latests构建: http://github.com/abelaska/jedis-lock/dow
jedis2.9的jar包和源码包,免费下载分享,如果有问题的话,可以评论讨论,互相学习,以后会分享更多的开源的jar包供大家使用
jedis-2.6.2.jar最新的jedis包
自己用maven生成的,不包含test文件夹。 包含jedis-3.0.0.jar,jedis-3.0.0-sources.jar,jedis-3.0.0-javadoc.jar