makeImageRequest => caching?

Hi all,

I have a question regarding "makeImageRequest": how exactly is the caching done? I have an application which in some cases needs to update an icon every few seconds to assure a changed status is visualized. On the simulator this works fine, I guess because there no proxy is used. On the device however it does not work in a consistent way. The icon seems to update in one call but in the next one it suddenly falls back to the previous icon again. My assumption is that the proxy does some caching but I need a confirmation. Also, is there a way to disable the caching entirely? The webserver is sending a "no-cache"-header already, but this does not seem to make any difference.

Any suggestions?

Thanks!

  • Also, is there a way to disable the caching entirely? The webserver is sending a "no-cache"-header already, but this does not seem to make any difference.

    I don't really have any practical experience with the Communications module, but can't you set a placeholder param which changes on every request (e.g. use a value which is derived from the current time)?

  • Hi ,

    actually I am doing that already. I placed the following snippet while generating the request:

    params["time"] = Sys.getTimer();

    Unfortunately this also does not help, that is why I wanted to ask how the caching actually works

  • Ah :/

    Again, I have no idea if this would work and I don't know if you've tried it, but does it make a difference if you pass null for the params, construct the query string manually and put it in the url yourself?

  • In my opinion there is no difference between sim and device besides of no GC.

    If you can see new icon it should be in cache so next req should return rather newest one.

    The problem can be with time 

    - A app calls webReq

    - B device calls phone

    - C phone calls web

    - D ...

    -E onRecive()

    if icon can change several time between A-E you really don't which one you get. On sim everything run fast so A almost = E

  • Do you (I don't mean you _psx_, but OP) get headers back with the webrequest? You can put the timer in the header you get back. And than only update it when it is newer than the previous response. There is an edge case tho, getTimer() can flip numbers to very low again (every so many days), so you might need a different approach.

  • Hi guys,

    thank you very much for your ideas. Here some details to give more insight:

    - icon can change very frequently

    - I never fire multiple parallel requests. The logic starts one request, waits for the icon to be received, starts a timer for 2 seconds, fire next icon request. Therefore there is no risk to not know which icon we will receive.

    - I am receiving headers and could put some information there to know when the icon changed, but I don't think that this is the actual problem. Normally I am expecting to always receive the correct icon, the proxy cache seems to hook inbetween...

    - as the icon is received correctly every time in simulator but not on device, there seems to be a difference. I am even assuming that simulator does not use the proxy as this would waste resources, but I don't know for sure.

    Bye

  • I don't think it's possible on device to make weReq every 2s. So probably returning iconsm saree good but not from the same time when req w was. You try to use CIQ as real time app -impossible, especially of you need webReq when respond is additionally converted by Garmin.

  • Fair point, but then the question is how often am I allowed to update an image? Do you know what the limitation here is?I can also update every 5 seconds but for that I'd need to know how often this call is allowed.

  • In general, I wouldn't do a makeImageRequest or makeWebRequest every 5 seconds as it will have a battery impact and thems could also get lost.  With a background service you can only do it every 5 minutes (at most)

  • The update calls are executed only for a short time, as long as the user is interested in the status, which usually is 10-30 seconds, but I get your point. Still it would be great if somebody from Garmin could shed some light on this topic how the "makeImageRequest" works in conjunction with the proxy server...