Caching network.request'ed files in fsCachedData

I’ve just been debugging a frustrating issue with one of our apps, and I traced it to the fact that when I asked Corona to download a file with network.request, it was using a cached (and incorrect) copy of the file that lived on the device.

If I connect the device to my mac and then explore it using XCode or iFunBox, and browse inside the app to Library/Caches/com.founders.app/fsCachedData, there is a cached file in there which as far as I can tell is being used instead of a new file fetched over the internet.

As to how the bad file got in the cache, that’s still an open question I’m trying to figure out, but the fact that the cache existed in the first place was a surprise to me.  I don’t think there’s anything about the use of this cache in the network.request documentation.  Can anybody confirm that Corona uses this cache, and if so, let me know whether there’s any way to bust the cache from inside Corona and actually retrieve a fresh file from the internet?

I need to remove the files in “fsCachedData” too.

My app calls a lot of network.request() & over time I found there are growing number of files in “fsCachedData”. My users have been complaining that the storage size of my app is growing like crazy and they have to delete my app.

There must be a way to remove the files in “fsCachedData”.

Please Corona, could you address this problem?

@slewpop, I didn’t see this the firs time you posted it.  You can always attach a query string to the end of your URL with a random number (the time in seconds, an incrementing value, etc)

http://somesite.com/someimage.jpg?cb=12319823

(the cb stands for cache bust, and isn’t a real thing, but a pretty rare key choice…)

That should bust the local cache and cause you to fetch the file for fresh from the server.

Rob

I need to remove the files in “fsCachedData” too.

My app calls a lot of network.request() & over time I found there are growing number of files in “fsCachedData”. My users have been complaining that the storage size of my app is growing like crazy and they have to delete my app.

There must be a way to remove the files in “fsCachedData”.

Please Corona, could you address this problem?

@slewpop, I didn’t see this the firs time you posted it.  You can always attach a query string to the end of your URL with a random number (the time in seconds, an incrementing value, etc)

http://somesite.com/someimage.jpg?cb=12319823

(the cb stands for cache bust, and isn’t a real thing, but a pretty rare key choice…)

That should bust the local cache and cause you to fetch the file for fresh from the server.

Rob