<br><div class="gmail_quote">On Mon, May 19, 2008 at 3:06 PM, Larry Garfield <<a href="mailto:larry@garfieldtech.com">larry@garfieldtech.com</a>> 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 <<a href="mailto:merlin@logrus.com">merlin@logrus.com</a>> wrote:<br>
> David Strauss wrote:<br>
>> Great proposal.<br>
>><br>
>> One addition: a way to invalidate the cache of an info hook if your<br>
>> info hook does something like reading from a database table. This<br>
>> would be the case if, say, your module generates a configurable set<br>
>> of ad blocks.<br>
><br>
> You echoed my issue comment as well. It's very very important to be able<br>
> to do this easily, IMO.<br>
<br>
</div></div>Ah, indeed! 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'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> static $cache = array();<br><br> $args = func_get_args();<br> $hook = $args[0];<br> unset($args[0]);<br> if (!is_string($hook)) {<br> $cache = array();<br> }<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> <br></div></div><br>