Giter Club home page Giter Club logo

Comments (5)

ageweke avatar ageweke commented on July 29, 2024

Leafo — sorry for the long delay. I think I mentioned that I was hiking the Pacific Crest Trail all summer, and development is hard to do with an iPhone in the backwoods. I finished a few days ago (all 2,650 miles, yeah!) and am increasingly back in civilization. Fortitude development should be back on track shortly.

So, static should automagically be smart enough to respect locale already. If you're not seeing that behavior, please let me know.

As for more-general varies support: I really like the idea you have above, and considered it during development. I do have one concern, however. Right now, static generates content lazily, then simply caches it in a Hash, keyed by the widget locale (or just nil if none is set). There's no expiration mechanism or limit to this cache. I think this is likely good enough for now (although I do have occasional concerns about it being a potential DoS attack, if HTTP clients can pass in totally arbitrary locales — I don't yet know if Rails restricts that or not).

If I added arbitrary varies support, it suddenly becomes a whole lot easier to accidentally create long-term, nasty memory leaks in your application, if you add a varies that depends on something that can, well, vary too much. At some point, you're much better off just using Rails' built-in view fragment caching mechanisms, which have pluggable backends and can expire old content, limit the amount of data kept, share it among processes, and so on.

Any thoughts on what the correct balance is? Or does the automagic behavior for locale take care of your problem well enough?

from fortitude.

leafo avatar leafo commented on July 29, 2024

Ah, I hadn't see the widget_locale stuff when I was working on this. I haven't had a need to do static with varying any other time yet, so definitely not a critical feature for me. I understand your fear of the implications that come with adding more complex caching though.

Maybe your static implementation can be built on top of rails' fragment caching? So you can get all the additional functionality it provides.

from fortitude.

ajb avatar ajb commented on July 29, 2024

I think I'm looking for the same thing in issue #9, just calling it by a different name.

from fortitude.

ajb avatar ajb commented on July 29, 2024

Hey @leafo,

Maybe your static implementation can be built on top of rails' fragment caching? So you can get all the additional functionality it provides.

I've got a WIP of this in #39; would appreciate some feedback if you have a sec!

from fortitude.

ageweke avatar ageweke commented on July 29, 2024

I’m gonna close this for now — it’d be great to fold discussion in under PR #54. :)

from fortitude.

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.