[horde] IMP IMAP DB Cache backend lifetime

Joao S Veiga jsveiga at rf.com.br
Wed Aug 30 10:56:15 UTC 2017


----- Message from Jan Schneider <jan at horde.org> ---------
> Zitat von Joao S Veiga <jsveiga at rf.com.br>:
>
>> ----- Message from Jan Schneider <jan at horde.org> ---------
>>
>>>> 1 - horde-clear-cache does not clear the IMP IMAP DB cache tables  
>>>> (horde_imap_client_data, horde_imap_client_metadata,  
>>>> horde_imap_client_message). Is there a script for clearing these  
>>>> tables, or doing it via sql is the only way?
>>>
>>> imp-query-imap-cache
>>>
>>>> 2 - the Db.php backend  
>>>> (framework/Imap_Client/lib/Horde/Imap/Client/Cache/Backend/Db.php) does  
>>>> have a clear($lifetime) function, but I couldn't find where is it  
>>>> called. Who is supposed to call that?
>>>
>>> See above.
>>>
>>>> 3 - it seems there's a missing ")" in that function at the DELETE  
>>>> statement (line 320 at  
>>>> https://github.com/horde/horde/blob/master/framework/Imap_Client/lib/Horde/Imap/Client/Cache/Backend/Db.php):
>>>>
>>>> $purge = time() - $lifetime;
>>>> $sql = 'DELETE FROM %s WHERE messageid IN (SELECT messageid FROM  
>>>> %s WHERE modified < ?';
>>>> foreach (array(self::MD_TABLE, self::MSG_TABLE) as $val) {
>>>>
>>>> I've searched for an sql error in the logs and couldn't find one  
>>>> for this statement, so maybe it's never called?
>>>
>>> Indeed, fixed for the next release.
>>>
>>> It's only called when using the --lifetime parameter with  
>>> imp-query-imap-cache.
>>>
>>
>>
>> Thank you Jan,
>>
>> So if I understood correctly, the imap cache old entries are only  
>> cleaned manually with the imp-query-imap-cache script, so there is  
>> no automatic "expiring" like for the horde cache files?
>>
>> Thanks again,
>>
>> Joao
>
> I don't think so.
>


Thank you again Jan, I'll implement that in my environment.

I'd just like to point out that the

protected function _createUid($mailbox)

in the Db.php does not set the "modified" field in  
horde_imap_client_data, leaving it NULL.

If it's called from set(), the "modified" is updated in the set()  
function, but not if called from setMetaData(), so we're left with  
many entries in horde_imap_client_data where the "modified" is NULL,  
thus not cleared by clear($lifetime).

Either "modified" should be set by _createUid() when creating the  
entry, or in the setMetaData() like in set(). I'd suggest in  
_createUid() (I'm modifying mine to do that), as it makes sure there  
is always a value, even if the other functions fail afterwards.

Regards,

Joao S Veiga



More information about the horde mailing list