[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zope3-users
Subject:    Re: [Zope3-Users] Ahh, counters... Best practice?
From:       Christian Theune <ct () gocept ! com>
Date:       2007-08-15 8:56:28
Message-ID: 1187168188.11161.1.camel () mindy
[Download RAW message or body]

Am Dienstag, den 14.08.2007, 17:21 -0400 schrieb Benji York:
> Jeff Shell wrote:
> > We're working on something where we need to allow site visitors to
> > rate items. It's the basic star-rating thing. We want to keep a count
> > of the number of votes along with the current value.
> 
> At work we've been contemplating an approach for use in some similar 
> situations we want to address.
> 
> In broad strokes: keep the updated value in memory, write the value to 
> the database "periodically" (for whatever value of "periodically" is 
> appropriate for the data).
> 
> This should work well when the value changes often and loosing the most 
> recent updates to the value isn't catastrophic.

I've used a similar approach in Zope 2. The only problem is that if you
use ZEO you end up with counters that always are slightly off. If your
use case can cope with that, then it's fine. I've used a thread in each
instance that flushed the value from memory to ensure that the flushing
is done serialized and doesn't conflict with running application
transactions.

Christian



_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic