[development] RFC: info hook standardization

Larry Garfield larry at garfieldtech.com
Tue May 20 00:31:16 UTC 2008


On Monday 19 May 2008, Darrel O'Pry wrote:

> > 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();
>   }
> }

I think you're misunderstanding what I mean by cached.  For an info hook, I 
mean cached to the database (either cache_set() or something like 
{menu_router}) so that it never gets called again except in unusual 
circumstances.  A static cache only lasts for the duration of the request, 
and is not what I mean by caching here.  Think hook_menu(), not hook_forms().

-- 
Larry Garfield			AIM: LOLG42
larry at garfieldtech.com		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson


More information about the development mailing list