[development] Variables, lookups, and memory usage

Adrian Rossouw adrian at bryght.com
Thu Dec 15 22:28:25 UTC 2005

On 15 Dec 2005, at 8:24 PM, Allie Micka wrote:
> I still have a consistent place to stash these settings ( lookup_set 
> () , lookup_get() ), but I only pull them as needed.  An overall  
> memory savings, and handy as well.
in my case it would be :
variable_load('realm', $id);

So the user module, would during init go :

variable_load('user', $user->uid);

Which would load that user's settings into the stack.
> The lookup_get() is functionally similar to the variable_get()  
> function, except that it requires a $realm parameter:
Exactly. I am proposing we extend variable get, not write a new  

>   lookup_get($realm, $name=null);  // without a name, it returns a  
> keyed array of the whole realm
Basically in my proposal it would be :

variable_get($name, $default, $realm = null, $id = null); // without  
a realm it returns the first variable at the top of the stack.

Adrian Rossouw
Drupal developer and Bryght Guy
http://drupal.org | http://bryght.com

More information about the development mailing list