Configure Redis in CUBA platform

Hi team,
Im using CUBA latest version. I need to batch update in the server. So by using Redis we are going to batch update the values in DB. How we can configure Redis with our CUBA platform…?

1 Like


Just a reminder, that CUBA application is basically a Spring application, so you can use almost all spring libraries in CUBA. So, for Redis, you can use spring-data-redis.

For example, we can create a service that will use Redis. To do this, you need to add a dependency in core module:

        compile ""
        compile "redis.clients:jedis:3.3.0"

And configure corresponding beans. I have Redis installed locally, so my configuration in core module looks like this (file spriing.xml):

    <bean id="jedisConnectionFactory" class=""
    <!-- redis template definition -->
    <bean id="redisTemplate" class=""

After that, you can create a service and use RedisTemplate in it like it is described in the Spring documentation. Simple example:

public class RedisServiceBean implements RedisService {

    private RedisTemplate<String, String> template;

    private ListOperations<String, String> listOps;

    public String storeBook(Book book) {
        listOps.leftPush(book.getTitle(), book.getAuthor());
        return listOps.rightPop(book.getTitle());

Then you can invoke this service from screens, other services, etc.There is a small PoC project attached. (84.5 KB)


Thanks lot Andrey…

Hi Kannan,

Did it help?

1 Like

Hi Andrey,
Yeah it was helpful…but we need some clarification …we are going to use redis cache to store data from that we will move the data to db…so we need how to configure server connection with redis in local…for example hostname and port we have to add in spring…where we have to add and how to configure the server connection…?

I have attached what i have add in spring.xml file…but it showing error…


Hi Kannan,

Which error do you get? I use the following configuration and it works for me:

    <bean id="jedisConnectionFactory" class=""
          p:host-name="" p:port="6379" p:usePool="true" p:database="0"/>

1 Like

Hi Andrey,
Tnx man…it is working…