HTML5 Metro App Image Caching


  • Hi all,

    Is there a built-in way to cache images in the WinJS framework? If not, what is the recommended way to store images for re-use (my application uses a LOT of images, so I am not sure storing them in a folder in my app's directory is the most efficient solution)?

    All help is greatly appreciated and I always accept an answer!

    Wednesday, February 13, 2013 10:15 PM


All replies

  • I think the best way will be to store them in the images folder. If you want to do something else, could you upload them to a photosharing site (like imageshack.us) and then in your app, link to the Pictures via the link.

    But Again, the easiest way is proberly the image folder way.

    Thursday, February 14, 2013 9:00 AM
  • Well, I understand how that's the easiest way, but its not very efficient. A power-user of my service may lose GBs of space to my app if I do it like that. There has to be another way!
    • Edited by sddhhanover Thursday, February 14, 2013 10:58 PM
    Thursday, February 14, 2013 10:57 PM
  • Those are really the only two ways to do it besides caching them in memory (horrible idea from the sound of how many images you have) thus it comes down to whichever is less evil:

    - Cache on disk (eats up user's hard drive space, more performant)

    - Cache in the web (eats up user's bandwidth, less performant)

    Thursday, February 14, 2013 11:55 PM
  • Hi sddhhanover,

    As other members have suggested, using file storage is the reasonable option for caching image data besides holding them in memory. And Windows Store apps have provided application specific file storage for storing local/temp files. You can use "LocalFolder" or "TemporaryFolder" storage to store the files. LocalFolder is preferred for long-term use while TemporaryFolder is better for short-term data files.

    #ApplicationData.LocalFolder | localFolder property (Windows)

    #ApplicationData.TemporaryFolder | temporaryFolder property (Windows)

    Here is the related MSDN reference and sdk samples:

    #Quickstart: Local application data (Windows Store apps using JavaScript and HTML) (Windows)

    #Application data sample

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Thursday, February 21, 2013 7:58 AM
    Friday, February 15, 2013 6:03 AM