title: How to implement redis distributed cache in spring boot application which shall allow to query on cached data as like RDBMS
body: <p>I have 2 layer <code>spring</code> boot application as below and wish to implement distributed 2nd level cache with <code>redis</code> as to improve the performance . 
  [Spring boot Architecture][1]<br>
     Here we are using <code>kubernates</code> 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 <code>cache</code>. 
  Wondering if there is any standard solution with <code>redis</code> to fetch data as like from traditional <code>RDBMS</code> .
  Here the hypothetical solution would be like on startup "Student Atomic Service A" shall load Student data from DB on <code>Redis cache</code> and then any subsequent delete/update shall first do the same in Db and then update in <code>Redis</code> also I should get the records from <code>Redis</code> the way we query <code>RDBMS</code>.
  e.g <code>select * from student where id &lt;10</code></p>
  
  <p>It would be great if anybody can point any hint of sample implementation here.</p>
  
  <p>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 <code>RedisTemplate</code> but do not find a api like the way we query to a DB can be made e.g. select * from student where id&lt;=5</p>
  
  <p>Do not see any <code>API</code> which shall allow me to do operations like <code>RDBMS</code> with <code>redis cache API</code></p>