Add default implementation of JredisPool

- Add DefaultJredisPool to pool JRedis connections

- Prevent returning the same resource to the pool
multiple times on JredisConnection close

- Fixes DATAREDIS-154 previous JRedis pool left
broken connections in the pool
This commit is contained in:
Jennifer Hickey
2013-06-11 17:39:13 -07:00
parent 280e6a6ccc
commit 265d4cd18f
11 changed files with 430 additions and 18 deletions

View File

@@ -134,7 +134,28 @@
p:host-name="server" p:port="6379"/>
</beans>]]></programlisting>
<para>As one can note, the configuration is quite similar to the Jedis one.</para>
<para>The configuration is quite similar to Jedis, with one notable exception. By default, the <literal>JedisConnectionFactory</literal> pools connections.
In order to use a connection pool with JRedis, configure the <literal>JredisConnectionFactory</literal> with an instance of <literal>JredisPool</literal>. For example:
</para>
<programlisting language="xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="jredisConnectionFactory"
class="org.springframework.data.redis.connection.jredis.JredisConnectionFactory">
<constructor-arg>
<bean
class="org.springframework.data.redis.connection.jredis.DefaultJredisPool">
<constructor-arg value="localhost" />
<constructor-arg value="6379" />
</bean>
</constructor-arg>
</bean>
</beans>]]></programlisting>
</section>