<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><DIV></DIV>
<DIV>Yes, I meant drupal_static(); I just couldn't think of the function when I wrote that (I haven't done that much D7 coding yet).</DIV>
<DIV> </DIV>
<DIV>Ah, see now you say that 10% of hook_init's are appropriate, so telling someone to always avoid it is bad advice. In all the coding that I have done, I have used hook_init() maybe three times (twice I know for sure). And one was largely a toss up between hook_init() and hook_boot() and I can guarantee was needed. And you probably add hook_exit() to the list of questionable usage.</DIV>
<DIV> </DIV>
<DIV>In the case where I created my own cache file, it was more an attempt to "help" the database keep the data available because rebuilding the data (taxonomy-based) could get quite heavy in certain circumstances. When I convert the module to D7, I may not need any of that because field data may already be cached any way. As a matter of fact, 90% of the module may no longer be needed.<BR> </DIV>
<P><FONT color=#ff007f size=4 face="bookman old style, new york, times, serif"><EM><STRONG>Nancy</STRONG></EM></FONT></P>
<P> </P>
<P><FONT face="arial, helvetica, sans-serif">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.</FONT></P>
<DIV><BR></DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 12pt"><BR><FONT size=2 face=Tahoma>
<DIV style="FONT-FAMILY: Courier New, monaco, monospace, sans-serif; FONT-SIZE: 10pt">
<HR SIZE=1>
</DIV>
<DIV style="FONT-FAMILY: Courier New, monaco, monospace, sans-serif; FONT-SIZE: 10pt"><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Pierre Rineau</DIV></FONT>
<DIV style="FONT-FAMILY: Courier New, monaco, monospace, sans-serif; FONT-SIZE: 10pt"><BR>If you mean drupal_static() </DIV>
<DIV style="FONT-FAMILY: Courier New, monaco, monospace, sans-serif; FONT-SIZE: 10pt"><BR>Sometimes, but when you are writing a hook_init(), in 90% of the cases<BR>you are wrong.</DIV>
<DIV style="FONT-FAMILY: Courier New, monaco, monospace, sans-serif; FONT-SIZE: 10pt"><BR>> Indeed using cache is a balancing act. When I added caching to one of<BR>> my modules, I checked its performance impact. Using the main cache<BR>> table made things worse because cache_get queries were taking longer<BR>> than no caching at all. So I created my own cache table and it solved<BR>> the performance issue that I was attempting to fix. I still don't<BR>> think it was a good substitue for a properly tuned database server,<BR>> but few people have those.<BR><BR>Using a different cache because it increases performances is not always<BR>the good way to go. If fetching a cache in global cache table is slower<BR>than rebuilding your data, then you should probably *always* rebuild it.<BR>Because if you are slower in the cache table than in your own doesn't<BR>mean you solved the problem by doing the custom table, it only means<BR>that you
delayed its negative effects because as soon as the site will<BR>scale in term of data volumetry, it will then happen again.<BR><BR>By using this kind of judgement instead of separating logically caches<BR>(critical/always used cache such as bootstrap and menu, or heavy and<BR>ponctual caches such as aggressive page cache) you break the sysadmin's<BR>work which is to distribute those bins over different cache backends<BR>(memcache, apc, xcache, database, ..) depending on the data volumetry<BR>and physical environment measured performance impact.<BR><BR>> Nancy<BR><BR>Pierre.<BR><BR><BR></DIV></DIV></div></body></html>