[horde] Sharing user information between hooks

Michael J Rubinsky mrubinsk at horde.org
Thu Oct 29 16:53:10 UTC 2015


Quoting Michael J Rubinsky <mrubinsk at horde.org>:

> Quoting Jens Wahnes <wahnes at uni-koeln.de>:
>
>> On Mon, Oct 26 2015, at 15:01:38 +0000, Michael J Rubinsky wrote:
>>
>>> Quoting Jens Wahnes <wahnes at uni-koeln.de>:
>>>> The reason to introduce code to write things into the session was to
>>>> save unnecessary LDAP requests that would otherwise have to be executed
>>>> in both Horde's hooks and IMP's hooks.  The bulk of LDAP requests we
>>>> see, however, seems to stem from the fact that a complete session is
>>>> set up (including hooks being run) whenever there is a request through
>>>> CalDAV or such.  And not only is a session created for the user
>>>> performing the CalDAV request, but also for all users that have granted
>>>> this user access to their calendars, plus all users that this user is
>>>> granting access to his or her calendars.  All in all, that's a lot of
>>>> sessions with lots of LDAP requests.  (Consider, for example, a group
>>>> of just 5 people granting calendar access to each other's personal
>>>> calendar.  Then you've got 5 LDAP requests per every CalDAV request.
>>>> If everyone within the group is accessing all 5 calendars via CalDAV,
>>>> that's 5*5*5 = 125 LDAP requests for just 5 people.)
>>>>
>>>> So I came to the idea to use memcache to cache the LDAP data, since we
>>>> make heavy use of memcache anyways.  I dug around the Horde API docs a
>>>> bit and came up with some code that looks like this (not exactly, but
>>>> close enough):
>>>>
>>>>
>>>> $memcache =
>>>> $GLOBALS['injector']->getInstance('Horde_Core_Factory_HashTable')->create($GLOBALS['injector']);
>>>
>>> This should be: $GLOBALS['injector']->getInstance('Horde_HashTable');
>>
>> Thank you for pointing this out.  It feels much better to have code
>> that interfaces with the rest of the system the way it is intended to
>> work. :)
>>
>> However, even when using the "getInstance('Horde_HashTable')" code, the
>> old problem remains that the prefix for memcache keys
>> ($conf['hashtable']['params']['prefix'] from conf.php) is not used.
>> Not such a big problem since I can work around that, after all, but
>> still leaves me with a feeling I'm not calling the Horde code
>> correctly.  Can you shed some light on that?
>
> I'll take a look. I'm not *that* familiar with the memcache code. I  
> see some places where we *might* be missing prepending the keys, but  
> I'm not sure.

Actually, the only place that this might be wrong is in the  
lock/unlock methods. Setting/deleting should work as expected.  
Horde_HashTable_Base:: has set/delete/get etc... methods that call a  
hkey() method which adds the prefix. After the prefix is added, the  
concrete _set/_delete etc... methods are called using the already  
prefixed keys. You'll have to check there to see why it's not working.

Alternatively, check that the expected config values are being grabbed  
in Horde_Core_Factory_Hashtable.



-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5751 bytes
Desc: S/MIME Signature
URL: <http://lists.horde.org/archives/horde/attachments/20151029/7b786b55/attachment.bin>


More information about the horde mailing list