javacachingehcacheojdbcjcs

How do I use Cache mechanism for returned database events


My database(Oracle) pushes rowID's when DML operations are performed and my java program has a listeners which handles the events and gets the rowID's.

For Example: Below are the values returned from database on DML operation

ROW: operation=UPDATE, ROWID=AAASjgAABAAAVapAAA

Now I have to store this rowID's in a cache? How do I do this in java? Any clues would help. I am thinking of JCS or Ehcache. Which one is preferrable?

Handling RowID's returned as part of DB events through a listener:

class DCNDemoListener implements DatabaseChangeListener
    {
      DBChangeNotification demo;
      DCNDemoListener(DBChangeNotification dem)
      {
        demo = dem;
      }
      public void  onDatabaseChangeNotification(DatabaseChangeEvent e)
      {
        System.out.println(e.toString());
      }
    }

Solution

  • Have a look at the basic caching documentation for Ehcache 2.9.0.

    Regarding recommendations on technology, hard to say given only limited information about the use case is presented.