Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Fastest way to Update VOs??????  (Read 9739 times)
lostatoll
Jr. Member
**
Posts: 15


View Profile Email
« on: September 14, 2010, 09:48:24 »

So basically, I have a large set of VOs being created from a remote service proxy. I also want to be able to update this data every couple minutes or so. I make new calls and get back the data, but my question is what would be the best method to only create VOs if they don't exist already?

I feel like it would be very inefficient to check one property of each VO as it's created. Thanks for any tips.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: September 15, 2010, 04:10:41 »

I assume you mean instances of the same VO with different IDs? You could always register a proxy to tend each VO, using the ID of the VO as the name to register the proxy by.

Or if you have the VO as a collection maintained by a single Proxy, you could have that Proxy keep a dictionary keyed by ID, so you could have that Proxy check its map for the ID to see if it exists.

-=Cliff>
Logged
lostatoll
Jr. Member
**
Posts: 15


View Profile Email
« Reply #2 on: September 17, 2010, 12:07:09 »

hey, yeah, I have 5 kinds of VO's with indexes all being stored in multiple dictionaries right now, a single proxy managing them all. There are between 50 - 200 of each kind. I never thought about having a proxy for each VO, that's interesting. I'm trying to think of how to accomplish that. Basically inside my service proxy that is currently creating the vo's, I just tie each one to a new type of proxy with the same id, and then super the data...?
Logged
lostatoll
Jr. Member
**
Posts: 15


View Profile Email
« Reply #3 on: September 17, 2010, 03:51:27 »

so, say I have one array of 100 VOs. stored in a proxy.

I was thinking I create a "live data" proxy that will hold search results data, have a command that filters through all of the vo's to the ones i want, and then sends a note to update the live data proxy, which refreshes my mediator. So basically having a proxy that always stores all the vos, and another one that basically stores a list of the ones I want to show up in my mediator.. is this what you'd consider the right way to do a simple search?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #4 on: September 18, 2010, 09:30:22 »

That depends on whether you're using Flex. If so, then you might just want to have the data in an ArrayCollection (as the data property of the Proxy). Send a reference of that to the mediator to populate its view component and also in a Command simply set a filter on the collection (rather than manually weeding out a new collection). Remember to refresh the collection after setting the filter and the view components will automagically update.

-=Cliff>
Logged
lostatoll
Jr. Member
**
Posts: 15


View Profile Email
« Reply #5 on: September 18, 2010, 11:28:14 »

yup, that's exactly what i did, except I'm not using flex. I stored all my different type of vo's in arrays and then stored all my arrays of vos in a dictionary in the data of my main proxy. Think I got it figured out, thanks as always cliff.
Logged
Pages: [1]
Print