1

I have 2 layer spring boot application as below and wish to implement distributed 2nd level cache with redis as to improve the performance . [Spring boot Architecture][1]
Here we are using kubernates and hence there could be multiple instances of "Atomic Service A" and hence the requirement of distributed cache. Though there could be few requests coming less frequently to modify the data in DB and same needs to be reflected in cache. Wondering if there is any standard solution with redis to fetch data as like from traditional RDBMS . Here the hypothetical solution would be like on startup "Student Atomic Service A" shall load Student data from DB on Redis cache and then any subsequent delete/update shall first do the same in Db and then update in Redis also I should get the records from Redis the way we query RDBMS. e.g select * from student where id <10

It would be great if anybody can point any hint of sample implementation here.

I have gone through various sites but they only talk about key value thing but wish to find a DB Query like solution where the queried result shall get returned from cache. I have tried POC with RedisTemplate but do not find a api like the way we query to a DB can be made e.g. select * from student where id<=5

Do not see any API which shall allow me to do operations like RDBMS with redis cache API

asked Aug 19, 2019 at 11:38

1 Answer 1

1

Do not see any API which shall allow me to do operations like RDBMS with redis cache API

Typical RDBMS ( like MySQL, Oracle etc.) and Redis are different datastores with different data models and query language so they have virtually nothing in common except they are persistent data stores. You can have two different level of abstractions integrating with these data stores. One abstraction is at a repository level - what framework like Spring Data Redis provides.For Spring Data Redis repository check here. Another abstraction is provided by framework like Hibernate Data which provides integration with Redis via Hibernate OGM Redis module. This is more close to what you are expecting as it will give you a rich JPQL query language ( which is very close to SQL except that it operates on Objects rather than tuples). This may be worth checking out.

answered Aug 25, 2019 at 8:45
Sign up to request clarification or add additional context in comments.

1 Comment

I wonder how it can be used with springframework data and Hibernate OGM Redis examples in git talks about jpa.It would be great if you have handy springboot +redis example for this where ogm is integrated? It would be of great help

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.