On Mon, May 19, 2008 at 3:06 PM, Larry Garfield <larry@garfieldtech.com> wrote:

On Mon, 19 May 2008 11:23:02 -0700, Earl Miles <merlin@logrus.com> wrote:
> David Strauss wrote:
>> Great proposal.
>>
>> One addition: a way to invalidate the cache of an info hook if your
>> info hook does something like reading from a database table. This
>> would be the case if, say, your module generates a configurable set
>> of ad blocks.
>
> You echoed my issue comment as well. It's very very important to be able
> to do this easily, IMO.

Ah, indeed!  Make that 2 more attributes of an info hook:

- It has a commonly-named rebuild function: drupal_rebuild_$singularNoun() (or something).
- drupal_rebuild_$singularNoun() is called as part of the master cache reset function.

--Larry Garfield

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...

function module_invoke_all_cached() {
  static $cache = array();

  $args = func_get_args();
  $hook = $args[0];
  unset($args[0]);
  if (!is_string($hook)) {
    $cache = array();
  }
}

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.