Giter Site home page Giter Site logo

Comments (3)

ezeikel avatar ezeikel commented on June 2, 2024

Have added a temporary fix by commenting out this in apicache.js's sendCachedResponse function:

    Object.assign(headers, filterBlacklistedHeaders(cacheObject.headers || {}), {
      // set properly-decremented max-age header.  This ensures that max-age is in sync with the cache expiration.
      'cache-control':
        'max-age=' +
        Math.max(
          0,
          (duration / 1000 - (new Date().getTime() / 1000 - cacheObject.timestamp)).toFixed(0)
        ),
    })

Now the browser asks the server every time and if the server cache has it then it returns it, so not as quick but better than having no caching at all.

Having this does make sense and I want to add it back but it seems I'm getting inconsistent behaviour as explained above and I don't know why.

The only thing I can think of is that when the PUT request to a single resource happens the server knows that a resource has been updated and the browser cache gets ignored when a GET request for that resource is made. But a GET request for all of those resources doesn't know that a single resource has been updated so returns the browser cached version?

from apicache.

ezeikel avatar ezeikel commented on June 2, 2024

Have done some more digging around I believe it's because the Etag doesn't change for GET request to /sparks even though a resource has changed. Now wondering how you get the Etag to change for a collection where one of its resources has been updated

from apicache.

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.