tile_request_cache
is not used. Should it be removed?
#2010
smellyshovel
started this conversation in
Ideas
Replies: 1 comment
-
I tend to agree, this whole ajax file is filled with legacy code which we'll have a hard time reverse engineering. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There's this
makeFetchRequest
function now: https://github.com/maplibre/maplibre-gl-js/blob/main/src/util/ajax.ts#L134On the line 147
cacheIgnoringSearch
variable is explicily set tofalse
.Then on the line 214 there's an if-else block based on the value of this variable. Since the variable is a
false
constant, theif
branch is never executed. Hence thecacheGet
method never gets executed as well.If we revert the if-else statement, then caching seems to work as intended. But, on the other hand, what's the purpose of the variable and the if-else block still?
The other thing is whether there's any point in this
tile_request_cache
at all. I think that at some point in time Fetch API was implemented, but the out-of-the-box caching support for it has not been implemented yet, and therefore this "manual" caching was implemented on the level of GL JS lib.I might be mistaken, but I think that
tile_request_cache
could be removed altogether and instead of relying on it, we should let the browser do its best based on the response HTTP headers.For reference: https://hacks.mozilla.org/2016/03/referrer-and-cache-control-apis-for-fetch/
Beta Was this translation helpful? Give feedback.
All reactions