play-plugins icon indicating copy to clipboard operation
play-plugins copied to clipboard

Redis Java 2.5.X

Open djlitvak opened this issue 7 years ago • 0 comments

Previously, I had a question in here regarding something I was running into. Instead, I am going to post the answer and ask a new question.

Using the Redis plugin on 2.5.x, I have added the injection of the JedisPool and declared a jedis class variable.

` @Inject JedisPool jedisPool;

Jedis jedis; `

I have a method called "connect" that checks if jedis is null. If it is null, then it attempts to run jedis = jedisPool.getResource().

Currently, before any cache operation, I call the connect method.

I feel like this is overkill and wrong. Do you guys have any suggestions for how to manage this? Is there a way with Play 2.5.x and Java to use the CacheApi?

djlitvak avatar Mar 02 '17 02:03 djlitvak