[development] DEP - cascading variable system

Gerhard Killesreiter gerhard at killesreiter.de
Wed Nov 30 19:33:02 UTC 2005


Chris Johnson wrote:

> Moshe Weitzman wrote:
>
>> about #4. I'd like for user variables to be loaded into the $user 
>> object  so that we don't go to the DB for them multiple times on a 
>> page view. For example, lets say we invent a user pref called 'show 
>> signatures' and I set that to FALSE because I am on a low bandwidth 
>> connection. I would not want a variable_get('show signatures') to hit 
>> the DB every time we show a node or comment. maybe a static cache 
>> would solve this.
>
>
> Umm, doesn't variable_get() only hit the database the _first_ time the 
> variable is requested on a page?  After that, it's in the global 
> $conf, isn't it?


Right. More specifically: The cached serialized array of variables is 
retrieved from the cache table and the vars are assigned to the $conf 
array. You can override those with vars from settings.php

>
> In general, I think it makes sense to keep user variables in 
> user-related tables, *not* in the {variables} table.
>

Anybody pursuing the user-variables-in-variable-table idea in earnest 
has just had a bad idea. (no, that is not waht I intended to write 
originally)

Cheers,
    Gerhard


More information about the development mailing list