locked
Image control http cache in Metro app problem

    Question

  • Hi:

    I'm showing a image in a page like this:

    <Image Source="http://th3.com/9.png" />

    I found that the image is download in a cache folder,

    Who can tell me how to control the cache.

    Thursday, May 31, 2012 9:58 AM

Answers

  • It's not recommended for apps to try to manage this cache.

    The cache will automatically be used when you set the image source to a URL, e.g. from your example:

    Source="http://image1.webscache.com/baike/haibao/ipad2/2011-04/ipad2_202767972-61-2011-04-15-10-01-02.jpg" />

    If you set the same URL again then it will automatically use the cached image if it has already been downloaded once.  You do not need to target the cached file's path yourself - that could actually be slower in some cases.

    If your app needs more control over saving images, then you can save a copy of the image to the app's local folder or some other location on disk.  However, it sounds like letting the system do it for you may be a better approach for your scenario.

     

     

     

    Monday, June 04, 2012 10:33 PM

All replies

  •  

    Hello,

     

    Would you please provide us more function describe of your question? What's the purpose of control the cache, how do you do after control the cache.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Friday, June 01, 2012 3:29 AM
  • Thanks for your replay!

     <StackPanel Grid.Row="1">
                        <Image Margin="10" Width="auto" Height="auto" Source="http://image1.webscache.com/baike/haibao/ipad2/2011-04/ipad2_202767972-61-2011-04-15-10-01-02.jpg" />
                        <Image Margin="10" Width="auto" Height="auto" Source="http://image1.webscache.com/baike/haibao/ipad2/2011-12/ipad2_347149-333-2011-12-06-11-59-15.jpg"/>
                    </StackPanel>

    Winrt download the image for the app auto to the dir 

    C:\Users\wak\AppData\Local\Packages\PPStream_zx5b9w9evhx0y\AC\INetCache\J47OQ6A9\ipad2_100625-61-2009-09-07%2017-05-20[1].jpg

    C:\Users\wak\AppData\Local\Packages\PPStream_zx5b9w9evhx0y\AC\INetCache\6DGJBF39\ipad2_95403-61-2010-06-03%2009-30-43[1].jpg

    so, i want to know how long will the http image cache exprised, and how can i get the cached image file path.

    Saturday, June 02, 2012 1:05 PM
  • It's not recommended for apps to try to manage this cache.

    The cache will automatically be used when you set the image source to a URL, e.g. from your example:

    Source="http://image1.webscache.com/baike/haibao/ipad2/2011-04/ipad2_202767972-61-2011-04-15-10-01-02.jpg" />

    If you set the same URL again then it will automatically use the cached image if it has already been downloaded once.  You do not need to target the cached file's path yourself - that could actually be slower in some cases.

    If your app needs more control over saving images, then you can save a copy of the image to the app's local folder or some other location on disk.  However, it sounds like letting the system do it for you may be a better approach for your scenario.

     

     

     

    Monday, June 04, 2012 10:33 PM
  • How we can change cache destination. I want use temp folder on my ram drive for caching.
    Saturday, September 08, 2012 11:30 AM