Is there a size limit for LocalShared Objects crea

2019-07-26 08:06发布

问题:

For a mobile app project I am caching lot of data for offline use into the app.

So far I've been using Classic SharedObjects, storing every data in a couple of fat xmls (as strings in SharedObjects). The images are saved through the FileSystem Class.

I'm now wondering if it is good practice or if I should write my xmls in Files rather than Shared Objects.

My SharedObject's size is 3.6 Mo.

Thanks :)

回答1:

In AIR, it is generally recommended (by developers on here and the Adobe forums as well as the occasional Adobe evangelist) that you avoid using SharedObject entirely. It's meant to be used as a way to store files in a browser's temp file directory. With AIR, you are given far more control using the File and FileStream classes.

As for a size limit, the docs state the max size for a SharedObject is 100 kb. That is, as far as I know, a soft limit. It varies based on client, but it should always be around 100 kb. This is one of the main reasons why it is recommended you use the File and FileStream classes - there is no size limit (beyond the 4GB max file size for a 32 bit system, obviously). You also have full control over the location of the object, the life cycle of it, the security of it, etc.

In short, I highly recommend switching to using the File and FileStream classes when using AIR and use SharedObject only when working with a browser-based SWF