This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Redis synchronization with database

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
 
Saloon Keeper
Posts: 5711
144
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • 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
  • 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
Saloon Keeper
Posts: 5711
144
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • 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.
 
Bartender
Posts: 20933
127
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!