[horde] Sharing user information between hooks
Michael J Rubinsky
mrubinsk at horde.org
Thu Oct 29 16:47:46 UTC 2015
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.
>> The Horde_Core_Factory_HashTable class is registered with the injector
>> as the factory to use to create the hash table driver. If interested,
>> this is done in Horde_Registry::__construct().
>
> Unfortunately, I don't quite unterstand what you're trying to tell me.
> Should this give me a clue as to where to look for code that does the
> prefix handling? Or is it totally unrelated to that question?
Sorry, I was just explaining why the getInstance('Horde_HashTable')
works the way it does, and where the code is that registers the
injector/factory names in case you were interested. :)
--
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/4b091ac5/attachment.bin>
More information about the horde
mailing list