Hi everyone…
For some hours I’ve forgotten that Radiant have 5 minutes cache and I
has thinking that the snippet i’ve made was broken! I know this is a
newbie problem, but will be good if Radiant disable caching while in
devel enviroment, don’t you think?
About my snippet. Here is the code:
<r:find url="/news/">
<r:children:each by=“title” order=“asc”>
-
So I have a news Page, and various children thats are categories of
news. And this snippet list each category of news and the latest news
of that category. Its working. Do you think its ok? Or is it to much
worst? Its my first snippet
Thanks,
Mergulhão
It’s important to have caching enabled in development mode because the
caching is such a core feature of the way Radiant works. If it were
disabled, one would come upon a lot of surpises when moving to
production mode, especially if one were developing plugins or
extensions.
That’s a fine snippet, by the way. Good job! The cache should be
cleared automatically after a Snippet is saved.
Sean
Sean C. wrote:
It’s important to have caching enabled in development mode because the
caching is such a core feature of the way Radiant works. If it were
disabled, one would come upon a lot of surpises when moving to
production mode, especially if one were developing plugins or extensions.
Sean, can you elaborate on this? I am curious what your experiences
are, because I generally disable the cache especially when I am
developing extensions. I find it rather annoying otherwise, but maybe
I am approaching it the wrong way.
Cheers,
Oliver
I meant primarily that if you have extensions or plugins that provide
data to or modify the output of a page, you should be aware of the
interactions that it will have with the cache. For example, back in
August when I wrote the comments behaviors, I found that a page I wanted
to keep cached (the Commentable) would cache a redirect to itself, which
caused an irresolvable redirect loop. If I had run with caching off, I
might not have noticed that. So in a sense, I consider Radiant’s
caching to be a system feature rather than a side-effect of running in
production.
If Radiant used only Rails’ caching mechanisms, it might be easy to
ignore. However, even then, the cache needs to respond to the changing
needs of the system – you can’t rule it out entirely.
I guess what I’m trying to say is write your extensions or behaviors or
plugins with the consideration that unless you specifically set a
page/behavior to be uncached, you will have to deal with the
implications that come along with caching.
Sean