GithubHelp home page GithubHelp logo

Implement an HTTP cache about mapbox-cli-py HOT 9 CLOSED

mapbox avatar mapbox commented on June 19, 2024
Implement an HTTP cache

from mapbox-cli-py.

Comments (9)

perrygeo avatar perrygeo commented on June 19, 2024

It feels like caching belongs at the client level. My only concern about implementing caching on top of the sdk client (rather than in the sdk itself) is that we're one-level removed from the http request so we can't use any of the existing request caching libraries - most likely having to re-implement parts of those libs including cache keys, headers, invalidation, storage, etc. How heavy of a lift is that likely to be?

from mapbox-cli-py.

sgillies avatar sgillies commented on June 19, 2024

Okay, you're right. I'm going to look at making the cache configurable so that we can use the in-memory when we want and a disk cache for the CLI.

from mapbox-cli-py.

perrygeo avatar perrygeo commented on June 19, 2024

With mapbox/mapbox-sdk-py#101 merged, isn't that just a matter of the CLI passing in a different cachecontrol.cache object?

from mapbox-cli-py.

sbma44 avatar sbma44 commented on June 19, 2024

Is there any concern about this making debugging more difficult as we support users? I'm imagining someone who has their ratelimit adjusted upward and expects CLI behavior to respond accordingly. Making plugging in a cache easy sounds great, but I would never expect a command line tool like curl to do this by default.

from mapbox-cli-py.

perrygeo avatar perrygeo commented on June 19, 2024

@sbma44 I think the idea would be to respect the HTTP headers so we really wouldn't be caching any more aggressively than the API tells us to.

Still, it might make sense to make caching off by default. Turn it on via an optional --cache or config file? @sgillies what did you have in mind for the interface and configuration?

from mapbox-cli-py.

sgillies avatar sgillies commented on June 19, 2024

@sbma44 aren't the cache control and etag headers we send with geocoding responses a signal to clients that they can benefit from caching? Or are those intended mainly for CloudFront?

How about this: no caching by default until we've got the implications of account upgrading figured out and largely solved? Until then, users would be able to set a cache directory in their config file or on the command line.

from mapbox-cli-py.

sbma44 avatar sbma44 commented on June 19, 2024

@sgillies to date I think those headers have been considered solely in the context of CloudFront. Certainly we've never tuned them to my knowledge.

I like your proposed solution/stopgap: make caching easy, but not enabled by default.

from mapbox-cli-py.

sgillies avatar sgillies commented on June 19, 2024

I'm going to table this until the CacheControl bug I mentioned in mapbox/mapbox-sdk-py#100 gets fixed.

from mapbox-cli-py.

perrygeo avatar perrygeo commented on June 19, 2024

closed in mapbox/mapbox-sdk-py#100

from mapbox-cli-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.