PMTiles icon indicating copy to clipboard operation
PMTiles copied to clipboard

Add CACHE_CONTROL env, deprecate CACHE_MAX_AGE

Open MarkusWendorf opened this issue 1 year ago • 1 comments

Hey there

As discussed I would like to deprecate the CACHE_MAX_AGE option in favour of CACHE_CONTROL.

Users would then be able to set any CACHE_CONTROL directive they might need like stale-while-revalidate or s-maxage.

The change to add this feature would be rather small, however I had too much time on a train ride and improved a few things for readability.

Changes:

  • give variables meaningful names (avoid o, p, a, e etc.)
  • restructure the file so one can read it from top to bottom (env first, globals, handler entrypoint, data source implementation)
  • add types for environment variables in node.js
  • remove type casts (type narrowing with if)
  • use function keyword for all top level functions (instead of mixing const fn = () => {} and function fn() {})

I know that my changes have gone a little far for this feature 😅, but I think this would also help future contributors (I'm open to split the PR in feature and code readability).

Thank you

MarkusWendorf avatar Jun 11 '24 15:06 MarkusWendorf

@MarkusWendorf can you split this into the feature for CACHE_CONTROL PR and then the refactoring after that? That will let me merge the feature and update the docs, etc sooner. Thanks

bdon avatar Jun 27 '24 10:06 bdon

Closed in favor of https://github.com/protomaps/PMTiles/pull/423

MarkusWendorf avatar Jul 08 '24 19:07 MarkusWendorf