Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Log Reader / Agent ?

Status
Not open for further replies.

jhonty

IS-IT--Management
Jun 11, 2002
17
IN
How do I keep a data cache (in C++) keep the data in memory including any changes that can happen to the database? The Sybase server is System 11.

I want to create a data chache in C++ but how can I get the change that happenes to the log to the C++ program. I am looking for an agent that will read the log and call C++ classes with the changes to the database. Can I use replication Server to do this?

Any comments?
 
Sounds like a tough problem. I don't know of any documentation that Sybase publishes on the structure of the logs, so you'd probably have to deal with this in a less elegant fashion.

At various times, I've messed with this kind of stuff, but I don't know of any way to do it synchonously. If your cache absolutely, definitely has to be up to date and you don't want to hit the DB at all to determine if it's up to date, I don't know how you can do this. The replication notion is an interesting idea, but then you'd have to be able to read the replication queue (sounding like you might still have concurrency issues).

However, one way to deal with this would be to have a little table that just contains one bit for each table that's in your cache and another that represents key values for the changes (both maintained by trigger). When a process hits your cache, it would call a very short stored procedure that would just hit the table that indicates if the cache were up to date or not. If it is, you just return the cache data; otherwise you refresh the cache and return the data. Naturally, you could have a process that scanned the table and updated the cache without waiting for hits on it, but without hitting the DB, I just don't know any way to ensure that your cache is current.

Have you tried using the named caching capability on the DB itself to speed up access? I've even heard of people using a DB that's housed on RAM disk to speed things up.

It's been long enough since your original post that you may have figured something out by now. I'd be very curious to correspond with you directly about this.

Good luck!

John
nsjmcraig@netscape.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top