This project has moved and is read-only. For the latest updates, please go here.

Retreiving expired cached images from FileDbCache

Sep 25, 2015 at 9:38 AM
It seems FileDbCache.Get(key) returns null for expired items, which means TileImageLoader doesn't get a chance to use any expired cached images if DownloadImage fails.

I think this is highly undesired in most applications, if there's no Internet connection an application should show latest tiles instead of an empty map.

Sep 25, 2015 at 10:21 AM
FileDbCache does this by design to prevent a constantly increasing db file size.
You are free to take the existing implementation and modify it according to your needs.
Sep 25, 2015 at 12:14 PM
Thank you for your reply. The question is which solution will also be acceptable by you.

I think usability should come before maintainability, one can always maintain when needed (even from outside MapControl), but when the user sees an empty map then there's nothing to do about it right then.

In the meantime, is it possible to add a boolean to the FileDbCache constructor to indicate the instance should ignore expiration?
Sep 25, 2015 at 1:29 PM
Sorry, there won't be any changes in the current implementation.
Sep 30, 2015 at 12:51 PM
Edited Oct 1, 2015 at 6:50 AM
Here is a small non-breaking patch that will allow applications that lack consistent Internet connection, to take advantage of expired cached data:
public FileDbCache(string name, NameValueCollection config)
    : this(name, config["folder"], true)

public FileDbCache(string name, string folder) : this(name, folder, true)

public FileDbCache(string name, string folder, bool cleanNow)

    if (cleanNow)

I would greatly appreciate if you can incorporate this in the main code-base.
Marked as answer by superware on 12/25/2015 at 5:50 AM
Oct 11, 2015 at 10:14 AM
Hi ClemensF, can you please give FileDbCache this functionality?

I think most mobile applications would want to use cached data even if it's expired, it's definitely preferable over showing a blank map.

Oct 11, 2015 at 10:24 AM
As already said, there won't be such a change in the current FileDbCache implementation.

Go with your own implementation, or use ImageFileCache, which does not provide automatic expiration.