Forum BigDB Test to see if object has changed on server

Discussion and help relating to the PlayerIO database solution, BigDB.

Test to see if object has changed on server

Postby hersee » March 18th, 2014, 5:29 pm

Hi,

I'm wondering if there's a way to ask playerIO if a DatabaseObject has changed on the server and hence needs fetching again? I'd rather avoid fetching the full object, which is of reasonable size, regularly.

One option I've thought of is to forcibly modify a parameter in the object and save which should just update the changed parameter and report stale object if the database had changed. However this will cause unnecessary changes to the object making the chances of it having changed more likely.

Andrew
hersee
 
Posts: 7
Joined: October 23rd, 2013, 11:01 pm

Re: Test to see if object has changed on server

Postby Henrik » March 19th, 2014, 6:51 am

Yes, use the Optimistic Locking feature:

https://playerio.com/documentation/bigdb/advanced
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Test to see if object has changed on server

Postby hersee » March 19th, 2014, 10:08 am

Hi Henrik, thanks for your reply.

I'm using optimistic locking for updates to the object and for some reason had assumed that if the object has not changed locally then calling Save would do nothing, does it actually check to see if the object is stale despite there not being any changes? I'll have to do a test, I haven't noticed anything n the docs that suggest to me that it would but neither does it specifically say it won't.

As mentioned in my original post I want to avoid forcing something to save by modifying a parameter before calling save as this will result in unnecessary changes to the object and hence loads when other clients want to check if the object has changed etc.
hersee
 
Posts: 7
Joined: October 23rd, 2013, 11:01 pm


Return to BigDB



cron