ios - Parse.com data caching and synchronization -
ios - Parse.com data caching and synchronization -
what best strategy synchronize parse objects across application?
take twitter example, have many tweet objects, same tweet object can shown on multiple places, viewcontroller1 , viewcontroller2, not efficient both of them hold deep copies of same parse object.
when increment likecount of tweet_168 in viewcontroller2, how should update likecount of tweet_168 in viewcontroller1?
i created singleton container class (tweetcontainer) every parse request goes through , checks if incoming objectids in container, a) if is, updates previous object's fields , dumps new object. (to maintain single deep re-create of parse object.) b) if not, adds new object. (this process fast i'm using hashmaps)
this container holds deep copies objects, , gives shallow copies viewcontrollers, editing tweet in viewcontroller result in update on viewcontrollers!
taking 1 step further, let's tweet objects have pointers author objects. when author object updated, want of them updated (say image change). can create new authorcontainer same strategy , give shallow copies tweet objects in tweetcontainer.
i could, in ideal world, propagate every update cloud , refresh every object before showing user on cloud, that's not feasible neither bandwidth nor latency-wise
ios objective-c parse.com sync
Comments
Post a Comment