<br><div class="gmail_quote">On Mon, May 19, 2008 at 3:06 PM, Larry Garfield &lt;<a href="mailto:larry@garfieldtech.com">larry@garfieldtech.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c"><br>
On Mon, 19 May 2008 11:23:02 -0700, Earl Miles &lt;<a href="mailto:merlin@logrus.com">merlin@logrus.com</a>&gt; wrote:<br>
&gt; David Strauss wrote:<br>
&gt;&gt; Great proposal.<br>
&gt;&gt;<br>
&gt;&gt; One addition: a way to invalidate the cache of an info hook if your<br>
&gt;&gt; info hook does something like reading from a database table. This<br>
&gt;&gt; would be the case if, say, your module generates a configurable set<br>
&gt;&gt; of ad blocks.<br>
&gt;<br>
&gt; You echoed my issue comment as well. It&#39;s very very important to be able<br>
&gt; to do this easily, IMO.<br>
<br>
</div></div>Ah, indeed! &nbsp;Make that 2 more attributes of an info hook:<br>
<br>
- It has a commonly-named rebuild function: drupal_rebuild_$singularNoun() (or something).<br>
- drupal_rebuild_$singularNoun() is called as part of the master cache reset function.<br>
<font color="#888888"><br>
--Larry Garfield<br>
</font></blockquote><div><br>but this wouldn&#39;t be able to reset a static cache variable? would it? unless we had something like. I really like to two stage cache for things that might possibly only want to be cached per request...<br>
<br>function module_invoke_all_cached() {<br>&nbsp; static $cache = array();<br><br>&nbsp; $args = func_get_args();<br>&nbsp; $hook = $args[0];<br>&nbsp; unset($args[0]);<br>&nbsp; if (!is_string($hook)) {<br>&nbsp;&nbsp;&nbsp; $cache = array();<br>&nbsp; }<br>}<br>
<br>OT: I micro benchmarked { $var = arr[0]; unset($arr[0]); } vs { $var = array_shift($arr); } and the assign and unset is consistently about 10%-30% faster.<br>&nbsp;<br></div></div><br>