[development] RFC: info hook standardization
Darrel O'Pry
darrel.opry at gmail.com
Tue May 20 02:55:38 UTC 2008
I just think it wold be cool to support both options, as some items may be user specific. I'm not excluding normal cache_set/cache_get. I'm still think in terms of a more general cacheable module_invoke_all and not specifically hook_*_info.
-----Original Message-----
From: Larry Garfield <larry at garfieldtech.com>
Sent: May 19, 2008 8:31 PM
To: development at drupal.org
Subject: Re: [development] RFC: info hook standardization
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