[#12510] Driver: $_count cache gets dirty on modifications
Summary Driver: $_count cache gets dirty on modifications
Queue Turba
Queue Version Git master
Type Enhancement
State Feedback
Priority 1. Low
Owners
Requester thomas.jarosch@intra2net.com
Created 2013-07-29 (2438 days ago)
Due
Updated 2013-07-30 (2437 days ago)
Assigned 2013-07-29 (2438 days ago)
Resolved
Milestone
Patch No

Comments
Thomas Jarosch <thomas.jarosch@intra2net.com> 2013-07-29 13:44:46
Hi,

while reading through the Turba driver code, I've noticed
there is an internal cache for the total count of contacts: $_count.

A generic count() implementation is in lib/Driver.php and a more specific
one for SQL in lib/Driver/Sql.php.

IMHO we should reset (=unset) the count cache in 
lib/Driver/Sql.php:_add(), _delete() and _deleteAll().
Is the owner allowed to change in _save()? Then _modify() would be 
affected, too.
Same goes for the generic count function.

Cheers,
Thomas


Michael Rubinsky <mrubinsk@horde.org> 2013-07-29 22:14:05
The value of this only lasts for a single request, and is never called 
after a modification takes place in the same request.

However, these are the types of things that can later cause a headache 
trying to track down if this behavior ever changes. So if you provide 
a patch, I agree it should be committed.

Michael Rubinsky <mrubinsk@horde.org> 2013-07-29 22:15:26
Changing type: There is no broken behavior.

Thomas Jarosch <thomas.jarosch@intra2net.com> 2013-07-30 07:33:42
> The value of this only lasts for a single request, and is never 
> called after a modification takes place in the same request.
>
> However, these are the types of things that can later cause a 
> headache trying to track down if this behavior ever changes. So if 
> you provide a patch, I agree it should be committed.

In fact grepping the code for "->count()" shows it's not used at all 
(-> not exported by the API). Could we also just remove / deprecate it?

The real counting stuff in done in Turba_List.


Thomas Jarosch <thomas.jarosch@intra2net.com> 2013-07-30 07:43:22
> In fact grepping the code for "->count()" shows it's not used at all 
> (-> not exported by the API). Could we also just remove / deprecate 
> it?

Ok, forget about that: It works through the "Countable" mechanism
and is used by View/Browse.php only. Does not seem to be exported by the API.

I can take a look at this, though it's really low priority.
Let's get Kolab and ActiveSync playing nicely together first :)