• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Redis synchronization with database

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am a newbie to Redis.
I know that we can give commands in command line to cache the data.
But, how to synchronize my cache data to DB (say RDBMS, ORACLE DB).
If you give me a pointer, I can pick up

Thanks,
Guru
 
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

That's not really how Redis operates (or rather, what it is made for). You'll have to implement that in your own code.
 
Guru Ramamurthy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it so?

1. Create a topic so that data will be published to this
2. Write a program (Java or any other language), to subscribe to this topic, read and insert into DB?

If this is so, if there is a change in the DB table (say a new record insert in DB table), how we can copy this new record to REDIS?
Sorry, I am very new.
 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said, you will have to write the code to do that - Redis does not have facilities to read or write to a DB by itself.
 
Saloon Keeper
Posts: 28402
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
REDIS is strictly an in-memory cache. Rather than try and force it to be a local database cache, you should use a product that actually acts as a local database cache. For a discussion on such things, this may help: https://codeahoy.com/2017/08/11/caching-strategies-and-how-to-choose-the-right-one/

Alternatively, in Java there are facilities which manage the caching and database I/O as extensions of the application itself. Enterprise JavaBeans was designed this way, and many Java Persistence Architecture (JPA) libraries can do so as well - JPA is just a simplified version of EJB Version 3 that doesn't require full EJB services or servers.
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic