Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Add API to clear ambient cache #4376

Closed

Description

@1ec5

As of #4376, all cached resources are located in a file in Application Support instead of Caches, so any disk space taken up by ambient caching cannot be automatically reclaimed by iOS when disk space runs low. These resources are only removed when the application is deleted. This would become more of a problem if the application is permitted to raise the ambient cache size (#3437).

Perhaps MGLOfflineStorage should have a method that clears the ambient cache contents in the unified cache file, leaving any downloaded offline content intact. The application could provide UI for reclaiming the space taken up by ambient caching.

/cc @jfirebaugh

Activity

  1. added
    iOS
    macOS
    on Mar 18, 2016
  2. added
    Android
    on Mar 18, 2016
  3. zugaldia commented on Mar 18, 2016

    @zugaldia
    Member

    Adding the android tag as the current situation affects Android similarly.

  4. tsemerad commented on Sep 6, 2016

    @tsemerad

    Is there still no way to clear the ambient cache, other than reinstalling the app? I'm finding that when I update a tileset, my iOS client is still holding onto the previous tiles. Previously-cached tiles still show the old data, but fetching new tiles show the new data.

  5. 1ec5 commented on Sep 6, 2016

    @1ec5
    ContributorAuthor

    Is this tile set hosted by Mapbox or by you? If you’re hosting your own tile set, you can set a caching header in the HTTP response to force regular refreshes: #4446 (comment).

  6. tsemerad commented on Sep 6, 2016

    @tsemerad

    It's hosted on Mapbox. Do you know what Cache-Control: max-age header Mapbox serves the tiles with?

    Hosting the tiles myself wouldn't be ideal, but I can do so if necessary. But doesn't the new offline caching functionality (where you set a region) require that the tiles be hosted by Mapbox? Maybe I'm misremembering.

  7. zugaldia commented on Sep 8, 2016

    @zugaldia
    Member

    Just noting that, on Android, this is something that can easily be implemented by the developer today. For reference, we currently have a private method deleteAmbientDatabase that deletes the database that we used to use before offline landed. (This method name needs to be clarified once this new API is introduced.)

    To delete the current database, the developer would use similar code. The path could be obtained from OfflineManager.getDatabasePath() and the filename from OfflineManager.DATABASE_NAME.

    In any case, I like the idea of adding a specific API in the SDK.

  8. 1ec5 commented on Sep 8, 2016

    @1ec5
    ContributorAuthor

    Similarly, on iOS and macOS, it’s possible to delete the database (which contains all cached content, including downloaded offline packs) by pointing NSFileManager to this path. But the location of that file may change in a future release without notice, it’s probably only safe to touch this file before you use MGLMapView or MGLOfflineStorage in any way, and we don’t make any promises about how well this workaround would work even today. I’d expect the same caveats to apply to the Android SDK. So I’m pretty sure deleting the database isn’t an option for the use case described in #4376 (comment).

  9. RomainQuidet commented on Dec 6, 2016

    @RomainQuidet
    Contributor

    Hi,
    Any news about when this feature will be added ? which milestone ?
    Thanks.

  10. Superfuture commented on Jan 27, 2017

    @Superfuture

    Hi, any ETA on when this will be fixed? Thanks!

  11. haydenkaizeta commented on Sep 21, 2017

    @haydenkaizeta

    Android ETA?

  12. rinigus commented on Feb 24, 2018

    @rinigus
    Contributor

    If such API will be developed, would be great to get it for Qt as well.

  13. added
    Qt
    on Mar 6, 2018
  14. jeffypooo commented on Oct 26, 2018

    @jeffypooo

    +1 We'd love to have this feature.

  15. zugaldia commented on Feb 27, 2019

    @zugaldia
    Member

    /cc: @tmpsantos for prioritization.

  16. kkaefer commented on Apr 26, 2019

    @kkaefer
    Member

    PR is in #14365

  17. brunoabinader commented on Apr 29, 2019

    @brunoabinader
    Contributor

    Worth noticing that #14365 resets the entire database, including ambient cache and offline regions. As per discussions with @kkaefer, we should be able to clear ambient cache independently from offline regions via SQL queries.

  18. self-assigned this
    on May 6, 2019
  19. added 2 commits that reference this issue on May 17, 2019
    5414a7d
    418fdf3
  20. added a commit that references this issue on May 20, 2019
    1def782
  21. added this to the release-oolong milestone on May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

AndroidQtiOSmacOSoffline

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions