Comments (5)
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.
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.
I think I'm looking for the same thing in issue #9, just calling it by a different name.
from fortitude.
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.
I’m gonna close this for now — it’d be great to fold discussion in under PR #54. :)
from fortitude.
Related Issues (20)
- Unit testing of widgets without loading entire Rails stack in test environment? HOT 2
- Script to convert to and from HTML/ERb? HOT 3
- :csrf_meta_tags helper unavailable? HOT 1
- Even more forms weirdness, or... HOT 11
- Using #inline_html with a Rails view context HOT 2
- Implicit passing of `needs` variables fails when View class is named the same as the `needs` key HOT 4
- Can't mark HTML attribute values as html_safe HOT 1
- Upgraded to Rails 4.2.5.2 and everything is blowing up HOT 3
- use controller.view_paths to resolve view paths when calculating widget_class_from_file HOT 1
- Status? HOT 8
- alias_method_chain deprecated in Rails 5 HOT 2
- fix Travis build HOT 2
- Release latest code to rubygems HOT 1
- ArgumentError: wrong number of arguments (given 5, expected 4) with ActionView 4.2.6 HOT 2
- Issues when running tests: "uninitialized constant OopRailsServer::RailsServer::Bundler" HOT 1
- Regression: automatic inclusion of Rails helpers breaks implicit route arguments HOT 6
- Fortitude prevents Rails csrf_meta_tags from being rendered in the <head> element HOT 1
- retina_images repo unavailable
- Single arity template handlers are deprecated in Rails 6.0
- Still maintained? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fortitude.