This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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: 6527
160
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: 6527
160
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.
 
Saloon Keeper
Posts: 22289
151
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.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic