Interbase / Cacheing - A thought
Had a thought that I wanted to share. Interbase has a feature known as "event alerts". In a trigger you can post "events" which are just fixed data strings e.g. "DataAdded" or "Insert_tblUsers". A client database connection can register to listen to these events. I don't know if any Zopeish Interbase access method supports this (ODBC doesn't to my knowledge) but it would be incredibly useful for synching cached database objects. Zope could hold a representation of the table data in cached objects for quick access. Each object could have one or more "event" methods which related to a database event. When the database adaptor received an event message from Interbase it could inform all objects with a matching event method (these methods would refresh their cached data with current values from the database). In this way database and Zope cache could be synced *without* having to poll the database at an interval. In all, a very efficient mechanism. Just an idea I wanted to put out there. - Ian Sparks.
Ian Sparks wrote:
Had a thought that I wanted to share.
Interbase has a feature known as "event alerts". In a trigger you can post "events" which are just fixed data strings e.g. "DataAdded" or "Insert_tblUsers".
PostgreSQL has them too. It's not (afaik) supported by DB-API, but could be used in a DA that talks to some lower level API.
A client database connection can register to listen to these events.
I don't know if any Zopeish Interbase access method supports this (ODBC doesn't to my knowledge) but it would be incredibly useful for synching cached database objects. Zope could hold a representation of the table data in cached objects for quick access. Each object could have one or more "event" methods which related to a database event. When the database adaptor received an event message from Interbase it could inform all objects with a matching event method (these methods would refresh their cached data with current values from the database).
In this way database and Zope cache could be synced *without* having to poll the database at an interval. In all, a very efficient mechanism.
Just an idea I wanted to put out there.
Thanks for getting it out. I have been contemplating the same for PostgreSQL but have been too lazy to do it myself ;) ------------------ Hannu
Hannu, Does PostgresSQL allow you to have dynamic events? By this I mean can you do things like : PostEvent "Update_tblUsers_Record_" + new.RecordID; I believe that in Interbase the events are compiled into the trigger, not interpreted at Runtime so you can't have an Interbase event alert you to a change in a particular record, only that a change has occurred on a table. Coming from a RDBMS background myself I'd prefer to see RDBMS integration be tighter to Zope - properties etc being stored in the database where appropriate. For reasons of speed you don't want to have to go to the DB each time you want a property but having a data-aware object which knows when to update itself would solve this problem nicely. It should also help with load-balancing and failover where you could have a cluster of Zope instances all working on the same monster DB, all being kept in sync. via the event alerter mechanism. Just my thoughts. - Ian. ----- Original Message ----- From: "Hannu Krosing" <hannu@tm.ee> To: "Ian Sparks" <isparks@wmute.u-net.com> Cc: <zope@zope.org> Sent: Thursday, June 01, 2000 11:28 AM Subject: Re: [Zope] Interbase / Cacheing - A thought Ian Sparks wrote:
Had a thought that I wanted to share.
Interbase has a feature known as "event alerts". In a trigger you can post "events" which are just fixed data strings e.g. "DataAdded" or "Insert_tblUsers".
PostgreSQL has them too. It's not (afaik) supported by DB-API, but could be used in a DA that talks to some lower level API.
A client database connection can register to listen to these events.
I don't know if any Zopeish Interbase access method supports this (ODBC doesn't to my knowledge) but it would be incredibly useful for synching cached database objects. Zope could hold a representation of the table data in cached objects for quick access. Each object could have one or more "event" methods which related to a database event. When the database adaptor received an event message from Interbase it could inform all objects with a matching event method (these methods would refresh their cached data with current values from the database).
In this way database and Zope cache could be synced *without* having to poll the database at an interval. In all, a very efficient mechanism.
Just an idea I wanted to put out there.
Thanks for getting it out. I have been contemplating the same for PostgreSQL but have been too lazy to do it myself ;) ------------------ Hannu _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Ian Sparks wrote:
Hannu,
Does PostgresSQL allow you to have dynamic events? By this I mean can you do things like :
PostEvent "Update_tblUsers_Record_" + new.RecordID;
No, but it may change sometime (possibly soon) as PostgreSQL is an open-source product ...
I believe that in Interbase the events are compiled into the trigger, not interpreted at Runtime so you can't have an Interbase event alert you to a change in a particular record, only that a change has occurred on a table.
The same is true for postgrSQL, only the syntax is LISTEN/NOTIFY. -------- Hannu
participants (2)
-
Hannu Krosing -
Ian Sparks