Rotem Liss wrote:
I suggest to cache these calls results (as done with
"#time"), and to count
multiple calls to the same page as one call, in case someone wants to check the
same page multiple times. (Title objects are cached anyway, and so are the
article IDs, so they don't have to cause multiple queries anyway; they are
harder to check, though.) "Then" and "else" should not be cached,
just the title
and its result.
+1
In my little journey in the #ifexist abuse i have found that people use
this kind of constructs quite frequently:
Lorem ipsum (A ? <strong>: <small>) dolor (A ? </strong>:</small>)
sic
amet consectetuer adipiscing elit. (A ? "Proin quam. Praesent vulputate
libero eu arcu." : "") Cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus. (A ? "Pellentesque vitae
diam." : ) Proin elementum, purus eu rhoncus rhoncus, lacus nisi
hendrerit metus, et congue nunc ante vel odio.
So it's fixed doing:
if (A) {
Lorem ipsum <strong>dolor</strong> sic amet consectetuer adipiscing
elit. Proin quam. Praesent vulputate libero eu arcu. Cum sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Pellentesque vitae diam. Proin elementum, purus eu rhoncus rhoncus,
lacus nisi hendrerit metus, et congue nunc ante vel odio.
} else {
Lorem ipsum <small>dolor</small> sic amet consectetuer adipiscing elit.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus. Pellentesque vitae diam. Proin elementum, purus eu
rhoncus rhoncus, lacus nisi hendrerit metus, et congue nunc ante vel odio.
}
Which decreases the count incredibly (put that on a template called with
different arguments a lot of times from another template used on many
pages).
So caching the answer for each checked title on the same call will make
a difference (and is the sensible thing to do: nobody expects it to
return different on the same page, though the double race condition exists).
Maybe for clarity split them into '#ifexist count' and 'Active #ifexist
count'?