From: Fredrik J. <sqm...@fi...> - 2005-11-29 18:06:08
|
>>>> Initially I thought that caching a status respons is a good idea >>>> but now i have my doubts. If you request a status response you want >>>> a correct status. The filter plugin changes the status so if you >>>> work with caching status responses then you need to update the >>>> status in the cache as well. >>>> >>>> If you work with a status cache then cache the status into >>>> $aMailbox >>>> and not in a separate global array. >>>> >>>> 1.5.1 does caching different then 1.4.x. Probably the plugins >>>> newmail and filters should be adapted in order to take advantage of >>>> the changed cache. >>> >>> I understand what you are saying. But on the other hand, does it make >>> sense to ask the IMAP server for the status three times for each >>> mailbox, all within milliseconds of each other? Perhaps it would be >>> worthwhile to use the cache, and have the filters plugin modify the >>> cache. >>> >>> The way I implemented it, it is only cached on that execution. So the >>> status should not change within the extremely short amount of time >>> it takes to run the script, unless the squirrelmail code is changing >>> the status (as you indicated with the filters plugin) >> >> Disclaimer: I haven't looked at the code, so this post may be completly >> irrelevant. >> >> There are ways around getting an old cache. One is to have to >> functions, one is called when working with cached data is enough and the >> other is used when the cach have to be updated. > > Correct but if that's the case then blame the plugin and point to the > correct method of using the cache. > > The only correct method is disallow all direct imap communication by > plugins and create an API for plugins with methods that do the imap calls > and also update the related cached information. > >> Another approach is to add the cach time to the array mentioned in >> Jonathan's post and then compare the current time against it. If the >> cached time is older than x, the cache is updated. > > Older the how many ms? It isn't stored in the session so a timeout isn't > workeable. You will of course cach the the time in the session as well for this to work. The threshold could be defined in the function call, i.e. configurable by the code who needs to know. Sincerely, Fredrik. |