Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-side caching for fonts and tiles #72

Merged
merged 5 commits into from
Apr 1, 2024

Conversation

petrsloup
Copy link
Member

@petrsloup petrsloup commented Mar 11, 2024

RD-235

Objective

Add client-side caching using browser Cache API to reduce network load for repeated sessions.

Description

  • transformRequest + addProtocol used to hook into the maplibre
  • The cache is reused even between different map sessions (mtsid and key are ignored).
  • Soft limit of 1000 items in the cache, checked periodically, oldest items are then removed.
  • Special handling for TileJSON to actually propagate Last-Modified to the tile requests (so that the cache is not reused when outdated).

Acceptance

Tested locally

Checklist

  • I have added relevant info to the CHANGELOG.md

@petrsloup petrsloup self-assigned this Mar 11, 2024
@petrsloup petrsloup force-pushed the RD-235_improved-caching branch from 065b2ec to e73a061 Compare March 12, 2024 08:02
@petrsloup petrsloup changed the base branch from main to RD-225 March 12, 2024 08:02
@petrsloup petrsloup force-pushed the RD-235_improved-caching branch from 5d90cdc to 1f2ca3b Compare March 22, 2024 08:35
@petrsloup petrsloup changed the title WIP Improved caching Client-side caching for fonts and tiles Mar 22, 2024
@petrsloup petrsloup requested a review from jonathanlurie March 22, 2024 12:48
@petrsloup petrsloup marked this pull request as ready for review March 22, 2024 12:49
@jonathanlurie jonathanlurie changed the base branch from RD-225 to RD-239 April 1, 2024 07:38
Copy link
Collaborator

@jonathanlurie jonathanlurie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good

@jonathanlurie jonathanlurie merged commit 523c9fd into RD-239 Apr 1, 2024
1 check passed
@jonathanlurie jonathanlurie deleted the RD-235_improved-caching branch April 1, 2024 07:42
jonathanlurie added a commit that referenced this pull request Apr 2, 2024
* Making SDK compatible with MapLibre v4.1

* Allow the use of any (with a warning) as a type for compatibility reasons with MapLibre

* ENH moved all ML adapters into a dedicated folder

* ENH limit the language change to layers provided by MapTiler Cloud

* ENH reduced npm archive size

* Includes work RD-225

* FIX now exporting all the types from ML

* Update with MapLibre v4.1.2

* Client-side caching for fonts and tiles (#72)

* RD-235 WIP Improved caching

* RD-235 Rebase for maplibre 4

* RD-235 restructuring

* RD-235 Implement Cache API max size and purging + cleanup

* RD-235 Add changelog entry

* Fixed version of MapLibre

* Up changelog

* Readme: new caching section

* Added a banner picture to the readme

* Added backdrop in the list of styles

---------

Co-authored-by: Petr Sloup <slouppetr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants