Flex 4 Keeping Data Providers In Memory
I am working on a modularized Flex application, and I am trying to cut-down on the amount of client-server interact开发者_高级运维ion.
Every time a module is opened, a request is made to a web service to get values to bind to the Flex form. If a user closes the module, and then reopens it at another time during their session, the same web request will be made.
Since this data is static, i.e. not changing, I am thinking about creating global variables to hold the data providers. On the initial application load, a series of web service calls will be made to fill all needed data providers. Then, any time a module is opened, it can use these global providers instead of making unnecessary and repeated requests. These are NOT going to be huge providers, so I don't think browser memory should be a concern.
Does anyone have a more elegant way of doing this?
For static non-changing data; hard code it.
If you must ping the remote server for this data; implementing a caching mechanism to reduce back and forth overhead is fine.
精彩评论