3 Replies Latest reply on May 26, 2011 1:18 PM by UbuntuPenguin

    Second Level Caching


      I am new to flex.  I created one app which has some views.  Which calls a web service to get data from my database.  When I run this app, as its waiting for the data, a timer icon comes up indicating its waiting.  I also implemented a Gantt Chart which was written for the most part with Actionscript.  I noticed it never gives me that timer and if the data is not loaded, it just does not load it.  My real question is what settings did the gantt chart set so it no longer waits.


      Here is the issue.  I have class A  which contains a list of Class B objects.  If in my app, I instantiate a new Class B object and persist it, I noticed that when I reload the app the new Class B object is no longer listed in my Class A object.  I did some reading and learned this had something to do with Second Level Cache.  Because I updated the Class B, the Class A was not updated and so when I reloaded the App, the App just got what was in Cache which was the old Class A object containing the old list of Class B objects. Well, I turned off Second Level Cache and walla, my problem went away.  Cool.  Oh, wait, when I loaded the Gantt Chart, it no longer would load the data.  It didnt wait for it.  So, when I turned the Second Level Cache back on, now my Gantt Chart loaded the data on the second refresh because now the data was in L2 Cache.  So, now I am wondering how to solve my problem.  One idea was to turn off or no whatever is turned off or on in my Gantt chart so it does wait for the data.  But I didnt write the Gantt Chart code and I am too new to know how to do this.  Would Someone help me with this?

        • 1. Re: Second Level Caching
          UbuntuPenguin Level 4

          I don't really understand what your problem is.  But it sounds like this is an issue with your backend ORM, not so much a Flex issue.

          • 2. Re: Second Level Caching
            Michelle5002 Level 1

            No, it was not the backend.  And I still do not have a good answer.  I ended up turning off 2nd Level Caching so my backend updates were available instantly.  However, as stated before, my gantt Chart did not wait for the data to be available and so when it rendered the chart, it rendered it with no data.  Since the chart extended UIComponent and updateDisplayList which was what was being called to render the chart to begin with, I added a public function which called updateDisplayList and then added a event on the callresult so when the data was done loading, I called the new function which called the updateDisplayList which rendered the chart a second time but this time with the data.  Its not graceful because it actually renders the chart twice at startup.  But it did get the job done.  Maybe one day when I am better at Action Script, I will understand how to get this component to wait til the data is loaded before it renders it.  But I am not there now.  Of course, maybe someone will understand my question and help me.  that would be nice too.

            • 3. Re: Second Level Caching
              UbuntuPenguin Level 4

              Do you mind pointing me to a resource where I can learn more about second level caching in Flex/AS3 ?