Giter Site home page Giter Site logo

Cache invalidation about senna.js HOT 8 CLOSED

henvic avatar henvic commented on May 22, 2024
Cache invalidation

from senna.js.

Comments (8)

eduardolundgren avatar eduardolundgren commented on May 22, 2024

Either solution SGTM. Worth researching with one you think makes more sense, run some tests and take the decision. Let me know.

from senna.js.

henvic avatar henvic commented on May 22, 2024

Here are my findings: the best way to deal with caching for the RequestScreen is to not try to handle it at all. Just let the browser / server do it using ETags or whatever caching policy it's used. The developers just have to follow the standards (on the HTTP level, not HTML Pragma / Cache-Content meta tags).

from senna.js.

FagnerMartinsBrack avatar FagnerMartinsBrack commented on May 22, 2024

I assumed that leveraging http default cache machanism was the default behavior.

I am curious, what was the original motivation for using an alternative cache method?

from senna.js.

henvic avatar henvic commented on May 22, 2024

Senna is a spin-off of AlloyUI's surface module, which is used by the Liferay portal.

The reason why a JS-based caching mechanism was implemented there was because we needed it for some custom screens on the Liferay portal project.

How come this JS-based caching mechanism might be useful? Imagine you've some custom screens that are generated on the client-side or receive POST* request data. A JS-based caching mechanism is the way to go to improve performance.

  • Bad HTTP verb choice, for sure.

from senna.js.

FagnerMartinsBrack avatar FagnerMartinsBrack commented on May 22, 2024

Yeah, it makes sense.
For "senna" standalone project though, the POST request case is something to be considered if #59 is ever implemented. In that case it is a valid http verb.

from senna.js.

henvic avatar henvic commented on May 22, 2024

This doesn't relate with #59 directly.

A PostScreen could, theoretically, make use of it, but it's an abuse. We had this special case where caching it helped us achieve our goals due to legacy code that is going to be rewritten at some point (and was risky to change right now).

POST requests MUST NOT be cached, unless the response includes Cache-Control or Expires headers, which in this case will be automatically resolved by the browser and Senna MUST NOT deal with it.

References:
9 Method Definitions
13 Caching in HTTP

from senna.js.

FagnerMartinsBrack avatar FagnerMartinsBrack commented on May 22, 2024

Sure, standards should be respected.

I mentioned that it could be considered because there is is some evidence that most browsers were not that consistent in handling POST request caching. But that was long ago and this is probably not an issue anymore, haven't tested it.

from senna.js.

eduardolundgren avatar eduardolundgren commented on May 22, 2024

This should be enough for now https://github.com/liferay/senna.js/blob/master/src/app/App.js#L241. Thanks!

from senna.js.

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.