Git Product home page Git Product logo

Comments (3)

barelyknown avatar barelyknown commented on June 7, 2024

Have you thought much about this design? I can help implement it (I'll be working on something related soon).

from ember-jsonapi-resources.

pixelhandler avatar pixelhandler commented on June 7, 2024

@barelyknown haven't thought to much about it yet, other than I'd like to to be super flexible. I'd rather developers have control over the caching rules for their apps. This rfc https://github.com/jcollins1991/rfcs/blob/master/active/0000-data-loading-methods.md made me think that every app will have it's own needs for getting from cache in memory or from fetching from the server.

Awhile back I built a JS framework that would get from storage if not expired then fetch from server. So my initial though is that in the helpers for hasOne and hasMany we'll need hook to get from cache that developer can define how they want to do that. the default implementation can have a expiresIn value on the resource prototype and use the cache if that resource has a meta timestamp that is less than the expires time, e.g. 7 minutes or something like that. Also It would be awesome to honor the expires headers / etag from the fetch response headers.

Also by giving that hook not the resource (model) some data can be even set on localStorage and read there too.

from ember-jsonapi-resources.

barelyknown avatar barelyknown commented on June 7, 2024

I agree that a one-size-fits-all solution will be elusive. A solid set of hooks, maybe some out-of-the-box support for common strategies, and a cookbook of examples would be great.

Perhaps that means that we should start with the cookbook. As we implement examples of common strategies the abstraction will emerge.

from ember-jsonapi-resources.

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.