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

feat: added-cache-id #1307

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feat: added-cache-id #1307

wants to merge 1 commit into from

Conversation

am2222
Copy link

@am2222 am2222 commented Jul 9, 2024

This PR adds a cache-id query parameter to the tiles url. This helps to refresh client side cache when we update mbtiles on the server as its file hash changes and browser invalidates older caches

  • if file is mbtile it uses fileHash

  • if file is pmtiles it uses mtime (last modified time)

  • I need some more information about the tests. On my machine I was not able to run tests as it was missing test data folder. is there any way I can access them?
    Thanks

@am2222 am2222 mentioned this pull request Jul 9, 2024
@@ -242,6 +244,8 @@
}
} else if (inputType === 'mbtiles') {
sourceType = 'mbtiles';
tileJSON['cacheId']= await getFileHash(inputFile)

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (96% of all statements in
the enclosing function
have an explicit semicolon).
rs.on('error', reject);
rs.on('data', chunk => hash.update(chunk));
rs.on('end', () => resolve(hash.digest('base64')));
})

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (90% of all statements in
the enclosing script
have an explicit semicolon).
@acalcutt
Copy link
Collaborator

acalcutt commented Jul 9, 2024

For the test data, there is a link to it here https://github.com/maptiler/tileserver-gl?tab=readme-ov-file#getting-started-with-linux-cli under "Test from command line"

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