Best way clear out clients cache?

I have an external PHP application for my B2B operations that edits two tables that are also used by servoy. What is the best (and/or easiest) way to handle invalidating the client cache for my internal servoy clients when the tables are edited by this PHP app?

For example, a customer creates an order via the PHP app that edits the orders table and now for my office workers (using servoy) to see the order they have to logout of the solution and log back in.

There is a method databaseManager.refreshRecordFromDatabase().

Think that is what you need…

Depends how you want to handle it, how often the data gets edited by external apps and how often it’s viewed in Servoy.

Marcel’s comment works and is best used when the data is not often reviewed in Servoy.

If you need to keep the data in Servoy up to data realtime you could also create a database trigger (or a trigger in your PHP app) that will call the notifyDataChange function through the plugin API somehow.

If the Db supports java, you can integrate directly on the java layer, otherwise, you could create a JSP that used the headless client. You call the jsp from the DB trigger for example and in the JSp you call the notifyDataChange function through the headless client.

Paul

pbakker:
Depends how you want to handle it, how often the data gets edited by external apps and how often it’s viewed in Servoy.

Marcel’s comment works and is best used when the data is not often reviewed in Servoy.

If you need to keep the data in Servoy up to data realtime you could also create a database trigger (or a trigger in your PHP app) that will call the notifyDataChange function through the plugin API somehow.

If the Db supports java, you can integrate directly on the java layer, otherwise, you could create a JSP that used the headless client. You call the jsp from the DB trigger for example and in the JSp you call the notifyDataChange function through the headless client.

Paul

Humm…I like Marcel’s method for it’s simplicity although these two tables are viewed quite frequently inside of servoy thus invalidating the cache on every load in hope of a change (which I think would have to happen because of the rate of change) would probably prove to be to large of a hit to our shipping dept.

Looking at the API docs notifyDataChange sounds like the ideal way to handle things - alas I know zero java (more of a python guy) and while I have no doubt I could learn enough to get the plugin going, when it breaks at the most inopportune time I will probably be screwed :-/ . Oh well.

Out of curiosity, which rdbms support java integrations for something like you mention in your last point?

I know Oracle has Java integration, dunno about the others

Paul

But if you define the trigger at the database level that would be also triggered ( :) ) by the Servoy solution itself.
IMHO, it’s better to keep the logic away from the DB layer and just use a JSP call from PHP to notify Servoy that it needs to refresh some data from the backend.

True but in the trigger you can check whih user is doing the update/insert/delete an check if that is your dedicated Servoy user (you would have to have one)
Paul